From 744419de525013ad24b0034b4c048c6563624bf8 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Wed, 10 Jun 2009 23:38:18 +0000 Subject: 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 --- cpp/src/qpid/client/SessionImpl.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'cpp/src/qpid/client/SessionImpl.cpp') 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(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; } -- cgit v1.2.1