summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2009-06-10 23:38:18 +0000
committerGordon Sim <gsim@apache.org>2009-06-10 23:38:18 +0000
commit744419de525013ad24b0034b4c048c6563624bf8 (patch)
tree64c39c82d214c45f453c2bc5b59521f38e05b958 /cpp
parentf1639e6017fc1c073b60502cfaad38d38478364f (diff)
downloadqpid-python-744419de525013ad24b0034b4c048c6563624bf8.tar.gz
Ensure that messages sent by clusters update client are correctly fragmented based on the max frame size for the session.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@783571 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/client/SessionImpl.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/cpp/src/qpid/client/SessionImpl.cpp b/cpp/src/qpid/client/SessionImpl.cpp
index 0c6af5d1ff..9fa9bc644c 100644
--- a/cpp/src/qpid/client/SessionImpl.cpp
+++ b/cpp/src/qpid/client/SessionImpl.cpp
@@ -289,15 +289,24 @@ Future SessionImpl::send(const AMQBody& command, const MethodContent& content)
}
namespace {
-// Functor for FrameSet::map to send header + content frames but, not method frames.
-struct SendContentFn {
- FrameHandler& handler;
- void operator()(const AMQFrame& f) {
- if (!f.getMethod())
- handler(const_cast<AMQFrame&>(f));
- }
- SendContentFn(FrameHandler& h) : handler(h) {}
+// Adaptor to make FrameSet look like MethodContent; used in cluster update client
+struct MethodContentAdaptor : MethodContent
+{
+ AMQHeaderBody header;
+ const std::string content;
+
+ MethodContentAdaptor(const FrameSet& f) : header(*f.getHeaders()), content(f.getContent()) {}
+
+ AMQHeaderBody getHeader() const
+ {
+ return header;
+ }
+ const std::string& getData() const
+ {
+ return content;
+ }
};
+
}
Future SessionImpl::send(const AMQBody& command, const FrameSet& content) {
@@ -318,8 +327,8 @@ Future SessionImpl::send(const AMQBody& command, const FrameSet& content) {
frame.setEof(false);
handleOut(frame);
- SendContentFn send(out);
- content.map(send);
+ MethodContentAdaptor c(content);
+ sendContent(c);
return f;
}