Author: gsim
Date: Mon Apr  7 04:51:07 2008
New Revision: 645470

URL: http://svn.apache.org/viewvc?rev=645470&view=rev
Log:
AsynchIoAcceptor.cpp: Limit output from codec to one buffer per 'idle' call.
PreviewConnectionCodec: Generate output frames for encoding while available and 
while they can fit in the buffer given


Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewConnectionCodec.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp

Modified: 
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewConnectionCodec.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewConnectionCodec.cpp?rev=645470&r1=645469&r2=645470&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewConnectionCodec.cpp 
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewConnectionCodec.cpp 
Mon Apr  7 04:51:07 2008
@@ -40,7 +40,7 @@
 }
 
 bool PreviewConnectionCodec::canEncode() {
-    if (!frameQueueClosed) connection.doOutput();
+    if (!frameQueueClosed && frameQueue.empty()) connection.doOutput();
     return !frameQueue.empty();
 }
 
@@ -56,6 +56,7 @@
             frameQueue.front().encode(out);
             QPID_LOG(trace, "SENT [" << identifier << "]: " << 
frameQueue.front());
             frameQueue.pop();
+            if (!frameQueueClosed && frameQueue.empty()) connection.doOutput();
     }
     if (!frameQueue.empty() && frameQueue.front().size() > size)
         throw framing::ContentTooLargeException(QPID_MSG("Could not write 
frame, too large for buffer."));

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp?rev=645470&r1=645469&r2=645470&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp Mon Apr  7 
04:51:07 2008
@@ -301,7 +301,7 @@
         return;
     }
     if (codec == 0) return;
-    while (codec->canEncode()) {
+    if (codec->canEncode()) {
         // Try and get a queued buffer if not then construct new one
         AsynchIO::BufferBase* buff = aio->getQueuedBuffer();
         if (!buff) buff = new Buff;


Reply via email to