summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2010-06-14 14:50:27 +0000
committerAndrew Stitcher <astitcher@apache.org>2010-06-14 14:50:27 +0000
commit227246d4d1052242396fa08682da1ffc40f684a2 (patch)
treec4e1bf71471a9a198a4f2f003d61aed1f452dfab /cpp/src
parent309c2a784b21f51934e7ace9bdf1a0a93f0f2d11 (diff)
downloadqpid-python-227246d4d1052242396fa08682da1ffc40f684a2.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@954495 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/sys/rdma/RdmaIO.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.h b/cpp/src/qpid/sys/rdma/RdmaIO.h
index d896217f01..655119b798 100644
--- a/cpp/src/qpid/sys/rdma/RdmaIO.h
+++ b/cpp/src/qpid/sys/rdma/RdmaIO.h
@@ -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 {