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 (