From 97b75790dfa2e7ec95927159c89914879970bc46 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Wed, 8 Sep 2010 16:49:22 +0000 Subject: Rearrange drain queue code so that it does't call the callback unless there are no outstanding write buffers git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@995137 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/rdma/RdmaIO.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp index f0ae7e5d77..3e0f1c1dad 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp @@ -123,15 +123,20 @@ namespace Rdma { do { newState = oldState = state.get(); doReturn = true; - if (oldState == IDLE) { - doReturn = false; + switch (oldState) { + case IDLE: if (outstandingWrites == 0) { + doReturn = false; newState = DRAINED; + break; } + /*FALLTHRU*/ + default: + draining = true; + break; } } while (!state.boolCompareAndSwap(oldState, newState)); if (doReturn) { - draining = true; notifyCallback = nc; return; } -- cgit v1.2.1