Author: astitcher
Date: Thu Mar  8 11:43:09 2007
New Revision: 516157

URL: http://svn.apache.org/viewvc?view=rev&rev=516157
Log:
 [EMAIL PROTECTED]:  andrew | 2007-03-08 19:42:43 +0000
 Correctly split reference messages into chunks shorter than
 the framesize

Modified:
    incubator/qpid/branches/qpid.0-9/   (props changed)
    incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessageMessage.cpp
    incubator/qpid/branches/qpid.0-9/python/cpp_failing.txt

Propchange: incubator/qpid/branches/qpid.0-9/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Thu Mar  8 11:43:09 2007
@@ -1 +1 @@
-8427bd24-ae5a-4eba-a324-d2fc9c9c6c77:/local/qpid.0-9.ams:1242
+8427bd24-ae5a-4eba-a324-d2fc9c9c6c77:/local/qpid.0-9.ams:1278

Modified: 
incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessageMessage.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessageMessage.cpp?view=diff&rev=516157&r1=516156&r2=516157
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessageMessage.cpp 
(original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessageMessage.cpp 
Thu Mar  8 11:43:09 2007
@@ -61,6 +61,7 @@
     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 @@
                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 @@
                                 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(

Modified: incubator/qpid/branches/qpid.0-9/python/cpp_failing.txt
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/cpp_failing.txt?view=diff&rev=516157&r1=516156&r2=516157
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/cpp_failing.txt (original)
+++ incubator/qpid/branches/qpid.0-9/python/cpp_failing.txt Thu Mar  8 11:43:09 
2007
@@ -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


Reply via email to