diff options
author | Andrew Stitcher <astitcher@apache.org> | 2007-03-08 19:43:09 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2007-03-08 19:43:09 +0000 |
commit | d44dcf7c41c2fb35854bf2542a390dd800facdfa (patch) | |
tree | d82a80506b7826359fbc02d0f8409431793464db | |
parent | 3c58b97b24cff3f140327befb24cff0faef1ea76 (diff) | |
download | qpid-python-d44dcf7c41c2fb35854bf2542a390dd800facdfa.tar.gz |
r1278@fuschia: andrew | 2007-03-08 19:42:43 +0000
Correctly split reference messages into chunks shorter than
the framesize
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@516157 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/lib/broker/BrokerMessageMessage.cpp | 18 | ||||
-rw-r--r-- | python/cpp_failing.txt | 1 |
2 files changed, 15 insertions, 4 deletions
diff --git a/cpp/lib/broker/BrokerMessageMessage.cpp b/cpp/lib/broker/BrokerMessageMessage.cpp index 35e5039e12..72efe6ea40 100644 --- a/cpp/lib/broker/BrokerMessageMessage.cpp +++ b/cpp/lib/broker/BrokerMessageMessage.cpp @@ -61,6 +61,7 @@ MessageMessage::MessageMessage( reference(reference_) {} +// TODO: astitcher 1-Mar-2007: This code desperately needs better factoring void MessageMessage::transferMessage( framing::ChannelAdapter& channel, const std::string& consumerTag, @@ -76,7 +77,19 @@ void MessageMessage::transferMessage( for(Reference::Appends::const_iterator a = reference->getAppends().begin(); a != reference->getAppends().end(); ++a) { - channel.send(new MessageAppendBody(*a->get())); + u_int32_t sizeleft = (*a)->size(); + const string& content = (*a)->getBytes(); + // Calculate overhead bytes + // Assume that the overhead is constant as the reference name doesn't change + u_int32_t overhead = sizeleft - content.size(); + string::size_type contentStart = 0; + while (sizeleft) { + string::size_type contentSize = sizeleft <= framesize ? sizeleft : framesize-overhead; + channel.send(new MessageAppendBody(channel.getVersion(), reference->getId(), + string(content, contentStart, contentSize))); + sizeleft -= contentSize; + contentStart += contentSize; + } } } @@ -109,8 +122,7 @@ void MessageMessage::transferMessage( transfer->getMandatory())); } else { // Thing to do here is to construct a simple reference message then deliver that instead - // fragmentmentation will be taken care of in the delivery - // if necessary; problem is to invent a reference name to use + // fragmentation will be taken care of in the delivery if necessary; string content = body.getValue(); string refname = "dummy"; TransferPtr newTransfer( diff --git a/python/cpp_failing.txt b/python/cpp_failing.txt index 69c7cf3f5a..e126becbd5 100644 --- a/python/cpp_failing.txt +++ b/python/cpp_failing.txt @@ -1,4 +1,3 @@ tests.message.MessageTests.test_checkpoint -tests.message.MessageTests.test_reference_large tests.message.MessageTests.test_reject tests.basic.BasicTests.test_get |