summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/lib/broker/BrokerMessageMessage.cpp18
-rw-r--r--python/cpp_failing.txt1
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