From 057dc7e2b280714b096329b36b0f07f431884794 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 10 Dec 2002 16:59:53 +0000 Subject: [PATCH] fixed premature disconnect under load bug --- src/ca/tcpiiu.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index 8d99bda69..418a8d9d5 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -302,9 +302,6 @@ void tcpRecvThread::run () comBuf * pComBuf = new ( this->iiu.comBufMemMgr ) comBuf; while ( this->iiu.state == tcpiiu::iiucs_connected || this->iiu.state == tcpiiu::iiucs_clean_shutdown ) { - if ( ! pComBuf ) { - pComBuf = new ( this->iiu.comBufMemMgr ) comBuf; - } // // We leave the bytes pending and fetch them after @@ -358,8 +355,7 @@ void tcpRecvThread::run () // force the receive watchdog to be reset every 5 frames unsigned contiguousFrameCount = 0; - while ( contiguousFrameCount++ < 5 ) { - + while ( true ) { if ( nBytesIn == pComBuf->capacityBytes () ) { if ( this->iiu.contigRecvMsgCount >= contiguousMsgCountWhichTriggersFlowControl ) { @@ -376,7 +372,7 @@ void tcpRecvThread::run () this->iiu.unacknowledgedSendBytes = 0u; this->iiu.recvQue.pushLastComBufReceived ( *pComBuf ); - pComBuf = 0; + pComBuf = new ( this->iiu.comBufMemMgr ) comBuf; // execute receive labor bool protocolOK = this->iiu.processIncoming ( guard ); @@ -389,8 +385,9 @@ void tcpRecvThread::run () break; } - // allocate a new com buf - pComBuf = new ( this->iiu.comBufMemMgr ) comBuf; + if ( ++contiguousFrameCount >= 5 ) { + break; + } nBytesIn = pComBuf->fillFromWire ( this->iiu ); if ( nBytesIn == 0u ) { @@ -1345,7 +1342,7 @@ void tcpiiu::flushRequest () void tcpiiu::blockUntilBytesArePendingInOS () { -#if 0 +#if 1 FD_SET readBits; FD_ZERO ( & readBits ); while ( this->state == tcpiiu::iiucs_connected ) { @@ -1415,7 +1412,7 @@ void tcpiiu::blockUntilBytesArePendingInOS () bool tcpiiu::bytesArePendingInOS () const { -#if 0 +#if 1 FD_SET readBits; FD_ZERO ( & readBits ); FD_SET ( this->sock, & readBits );