qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r480178 - in /incubator/qpid/trunk/qpid/cpp/src/qpid: apr/LFSessionContext.cpp client/Channel.cpp
Date Tue, 28 Nov 2006 19:49:42 GMT
Author: gsim
Date: Tue Nov 28 11:49:41 2006
New Revision: 480178

URL: http://svn.apache.org/viewvc?view=rev&rev=480178
Log:
Bug fixes: corrected fragmentation of large messages in client, set buffer size on server
to be the same as the max frame size (this still needs some work to be better managed and
configurable).


Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/apr/LFSessionContext.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/apr/LFSessionContext.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/apr/LFSessionContext.cpp?view=diff&rev=480178&r1=480177&r2=480178
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/apr/LFSessionContext.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/apr/LFSessionContext.cpp Tue Nov 28 11:49:41 2006
@@ -33,8 +33,8 @@
     debug(_debug),
     socket(_socket),
     initiated(false),
-    in(32768),
-    out(32768),
+    in(65536),
+    out(65536),
     processor(_processor),
     processing(false),
     closing(false)

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp?view=diff&rev=480178&r1=480177&r2=480178
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp Tue Nov 28 11:49:41 2006
@@ -220,19 +220,21 @@
     AMQBody::shared_ptr body(static_pointer_cast<AMQBody, AMQHeaderBody>(msg.header));
     out->send(new AMQFrame(id, body));
     
-    int data_length = data.length();
+    u_int64_t data_length = data.length();
     if(data_length > 0){
-        //TODO fragmentation of messages, need to know max frame size for connection
-        int frag_size = con->getMaxFrameSize() - 4;
+        u_int32_t frag_size = con->getMaxFrameSize() - 8;//frame itself uses 8 bytes
         if(data_length < frag_size){
             out->send(new AMQFrame(id, new AMQContentBody(data)));
         }else{
-            int frag_count = data_length / frag_size;
-            for(int i = 0; i < frag_count; i++){
-                int pos = i*frag_size;
-                int len = i < frag_count - 1 ? frag_size : data_length - pos;
-                string frag(data.substr(pos, len));
-                out->send(new AMQFrame(id, new AMQContentBody(frag)));          
+            u_int32_t offset = 0;
+            u_int32_t remaining = data_length - offset;
+            while (remaining > 0) {
+                u_int32_t length = remaining > frag_size ? frag_size : remaining;
+                string frag(data.substr(offset, length));
+                out->send(new AMQFrame(id, new AMQContentBody(frag)));               
          
+                
+                offset += length;
+                remaining = data_length - offset;
             }
         }
     }



Mime
View raw message