You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2010/06/14 16:50:27 UTC

svn commit: r954495 - /qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h

Author: astitcher
Date: Mon Jun 14 14:50:27 2010
New Revision: 954495

URL: http://svn.apache.org/viewvc?rev=954495&view=rev
Log:
Try to avoid getting into a state where we can't send credit because we
sent the very last buffer without any credit. So in theory when we do have
credit to send we should have a buffer and xmit credit to do it with.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h?rev=954495&r1=954494&r2=954495&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h Mon Jun 14 14:50:27 2010
@@ -110,8 +110,17 @@ namespace Rdma {
         void doDrainedCallback();
     };
 
+    // We're only writable if:
+    // * not draining write queue
+    // * we've got space in the transmit queue
+    // * we've got credit to transmit
+    // * if there's only 1 transmit credit we must send some credit
     inline bool AsynchIO::writable() const {
-        return (!draining && outstandingWrites < xmitBufferCount && xmitCredit > 0);
+        assert(xmitCredit>=0);
+        return !draining &&
+               outstandingWrites < xmitBufferCount &&
+               xmitCredit > 0 &&
+               ( xmitCredit > 1 || recvCredit > 0);
     }
 
     inline int AsynchIO::incompletedWrites() const {



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org