summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2010-06-14 14:50:23 +0000
committerAndrew Stitcher <astitcher@apache.org>2010-06-14 14:50:23 +0000
commit309c2a784b21f51934e7ace9bdf1a0a93f0f2d11 (patch)
tree5a21bbb8841ccdbae1fbb3f70b5aef16647b1f95 /cpp/src
parent16d12a72918fa2d11c4439133e17c98c654ae604 (diff)
downloadqpid-python-309c2a784b21f51934e7ace9bdf1a0a93f0f2d11.tar.gz
Added asserts to ensure that we catch it if xmitCredit isn't sane
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@954494 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/sys/rdma/RdmaIO.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp
index bd0005dbe3..45295d470c 100644
--- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp
+++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp
@@ -171,6 +171,7 @@ namespace Rdma {
}
++outstandingWrites;
--xmitCredit;
+ assert(xmitCredit>=0);
} else {
if (fullCallback) {
fullCallback(*this, buff);
@@ -397,8 +398,10 @@ namespace Rdma {
// Get our xmitCredit if it was sent
bool dataPresent = true;
if (e.immPresent() ) {
+ assert(xmitCredit>=0);
xmitCredit += (e.getImm() & ~FlagsMask);
dataPresent = ((e.getImm() & IgnoreData) == 0);
+ assert(xmitCredit>0);
}
// if there was no data sent then the message was only to update our credit
@@ -430,6 +433,7 @@ namespace Rdma {
recvCredit -= creditSent;
++outstandingWrites;
--xmitCredit;
+ assert(xmitCredit>=0);
} else {
QPID_LOG(warning, "RDMA: qp=" << qp << ": Unable to send unsolicited credit");
}
@@ -453,6 +457,9 @@ namespace Rdma {
void AsynchIO::doWriteCallback() {
// TODO: maybe don't call idle unless we're low on write buffers
// Keep on calling the idle routine as long as we are writable and we got something to write last call
+
+ // Do callback even if there are no available free buffers as the application itself might be
+ // holding onto buffers
while (writable()) {
int xc = xmitCredit;
idleCallback(*this);