From 227246d4d1052242396fa08682da1ffc40f684a2 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Mon, 14 Jun 2010 14:50:27 +0000 Subject: 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 --- cpp/src/qpid/sys/rdma/RdmaIO.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid/sys') 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 { -- cgit v1.2.1