summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2010-06-14 14:50:18 +0000
committerAndrew Stitcher <astitcher@apache.org>2010-06-14 14:50:18 +0000
commit109374b124f6776e8e21d83ab8ef6b6badcbb14b (patch)
tree67cb7af9162ca400b8eba19b7db9aefa31e9d884 /qpid/cpp/src
parent46b6f57823b134ff77189719158a876d3eb3d630 (diff)
downloadqpid-python-109374b124f6776e8e21d83ab8ef6b6badcbb14b.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@954495 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/sys/rdma/RdmaIO.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
index d896217f01..655119b798 100644
--- a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
+++ b/qpid/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 {