From f4aa9c2e338e0653fd79489b719bf5fa7fd918dc Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 9 Nov 2005 23:55:15 +0000 Subject: [PATCH] fix for mantis 153 --- src/ca/tcpiiu.cpp | 18 +++++++++++++----- src/ca/virtualCircuit.h | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index 92f4573d0..b8307dffb 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -1667,6 +1667,7 @@ void tcpiiu::eliminateExcessiveSendBacklog ( // or unresponsive circuit if ( ! userRequestsCanBeAccepted || this->unresponsiveCircuit ) { + this->decrementBlockingForFlushCount ( mutualExclusionGuard ); throw cacChannel::notConnected (); } @@ -1681,11 +1682,7 @@ void tcpiiu::eliminateExcessiveSendBacklog ( this->flushBlockEvent.wait ( 30.0 ); } } - assert ( this->blockingForFlush > 0u ); - this->blockingForFlush--; - if ( this->blockingForFlush == 0 ) { - this->flushBlockEvent.signal (); - } + this->decrementBlockingForFlushCount ( mutualExclusionGuard ); } } else if ( ! this->earlyFlush && this->sendQue.flushEarlyThreshold(0u) ) { @@ -1694,6 +1691,17 @@ void tcpiiu::eliminateExcessiveSendBacklog ( } } +void tcpiiu::decrementBlockingForFlushCount ( + epicsGuard < epicsMutex > & guard ) +{ + guard.assertIdenticalMutex ( this->mutex ); + assert ( this->blockingForFlush > 0u ); + this->blockingForFlush--; + if ( this->blockingForFlush == 0 ) { + this->flushBlockEvent.signal (); + } +} + osiSockAddr tcpiiu::getNetworkAddress ( epicsGuard < epicsMutex > & guard ) const { diff --git a/src/ca/virtualCircuit.h b/src/ca/virtualCircuit.h index e2d9c9516..414d33d96 100644 --- a/src/ca/virtualCircuit.h +++ b/src/ca/virtualCircuit.h @@ -253,6 +253,8 @@ private: void disconnectNotify ( epicsGuard < epicsMutex > & ); bool bytesArePendingInOS () const; + void decrementBlockingForFlushCount ( + epicsGuard < epicsMutex > & guard ); // send protocol stubs void echoRequest (