From c50837d7f5fe7566cfab5ff53c01953e33625048 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 18 Apr 2003 22:06:19 +0000 Subject: [PATCH] removed msg minder --- src/ca/tcpiiu.cpp | 83 +++++++++++++++++++++-------------------------- src/ca/udpiiu.cpp | 76 ++++++++++++++++++++----------------------- 2 files changed, 72 insertions(+), 87 deletions(-) diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index 724d3a20c..891d852d3 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -139,14 +139,8 @@ void tcpSendThread::run () this->thread.exitWaitRelease (); { - // only one recv thread at a time may call callbacks - // - pendEvent() blocks until threads waiting for - // this lock get a chance to run - cacMessageProcessingMinder msgProcMinder ( this->iiu.cacRef ); - { - epicsGuard < callbackMutex > guard ( this->cbMutex ); - this->iiu.cacRef.uninstallIIU ( guard, this->iiu ); - } + epicsGuard < callbackMutex > guard ( this->cbMutex ); + this->iiu.cacRef.uninstallIIU ( guard, this->iiu ); } delete & this->iiu; @@ -332,48 +326,45 @@ void tcpRecvThread::run () // - it take also the callback lock this->iiu.recvDog.messageArrivalNotify ( currentTime ); - cacMessageProcessingMinder msgProcMinder ( this->iiu.cacRef ); - { - // only one recv thread at a time may call callbacks - // - pendEvent() blocks until threads waiting for - // this lock get a chance to run - epicsGuard < callbackMutex > guard ( this->cbMutex ); + // only one recv thread at a time may call callbacks + // - pendEvent() blocks until threads waiting for + // this lock get a chance to run + epicsGuard < callbackMutex > guard ( this->cbMutex ); - // force the receive watchdog to be reset every 5 frames - unsigned contiguousFrameCount = 0; - while ( nBytesIn ) { - if ( nBytesIn == pComBuf->capacityBytes () ) { - if ( this->iiu.contigRecvMsgCount >= - contiguousMsgCountWhichTriggersFlowControl ) { - this->iiu.busyStateDetected = true; - } - else { - this->iiu.contigRecvMsgCount++; - } + // force the receive watchdog to be reset every 5 frames + unsigned contiguousFrameCount = 0; + while ( nBytesIn ) { + if ( nBytesIn == pComBuf->capacityBytes () ) { + if ( this->iiu.contigRecvMsgCount >= + contiguousMsgCountWhichTriggersFlowControl ) { + this->iiu.busyStateDetected = true; } - else { - this->iiu.contigRecvMsgCount = 0u; - this->iiu.busyStateDetected = false; - } - this->iiu.unacknowledgedSendBytes = 0u; - - this->iiu.recvQue.pushLastComBufReceived ( *pComBuf ); - pComBuf = new ( this->iiu.comBufMemMgr ) comBuf; - - // execute receive labor - bool protocolOK = this->iiu.processIncoming ( currentTime, guard ); - if ( ! protocolOK ) { - this->iiu.cacRef.initiateAbortShutdown ( this->iiu ); - break; + else { + this->iiu.contigRecvMsgCount++; } - - if ( ! this->iiu.bytesArePendingInOS () - || ++contiguousFrameCount > 5 ) { - break; - } - - nBytesIn = pComBuf->fillFromWire ( this->iiu ); } + else { + this->iiu.contigRecvMsgCount = 0u; + this->iiu.busyStateDetected = false; + } + this->iiu.unacknowledgedSendBytes = 0u; + + this->iiu.recvQue.pushLastComBufReceived ( *pComBuf ); + pComBuf = new ( this->iiu.comBufMemMgr ) comBuf; + + // execute receive labor + bool protocolOK = this->iiu.processIncoming ( currentTime, guard ); + if ( ! protocolOK ) { + this->iiu.cacRef.initiateAbortShutdown ( this->iiu ); + break; + } + + if ( ! this->iiu.bytesArePendingInOS () + || ++contiguousFrameCount > 5 ) { + break; + } + + nBytesIn = pComBuf->fillFromWire ( this->iiu ); } } diff --git a/src/ca/udpiiu.cpp b/src/ca/udpiiu.cpp index bc71d307e..58d371523 100644 --- a/src/ca/udpiiu.cpp +++ b/src/ca/udpiiu.cpp @@ -244,46 +244,43 @@ void udpiiu::recvMsg ( callbackMutex & cbMutex ) this->recvBuf, sizeof ( this->recvBuf ), 0, & src.sa, & src_size ); - cacMessageProcessingMinder msgProcMinder ( this->cacRef ); - { - epicsGuard < callbackMutex > guard ( cbMutex ); + epicsGuard < callbackMutex > guard ( cbMutex ); - if ( status <= 0 ) { + if ( status <= 0 ) { - if ( status == 0 ) { - return; - } - - int errnoCpy = SOCKERRNO; - - if ( errnoCpy == SOCK_SHUTDOWN ) { - return; - } - if ( errnoCpy == SOCK_ENOTSOCK ) { - return; - } - if ( errnoCpy == SOCK_EBADF ) { - return; - } - if ( errnoCpy == SOCK_EINTR ) { - return; - } - // Avoid spurious ECONNREFUSED bug in linux - if ( errnoCpy == SOCK_ECONNREFUSED ) { - return; - } - // Avoid ECONNRESET from disconnected socket bug - // in windows - if ( errnoCpy == SOCK_ECONNRESET ) { - return; - } - this->printf ( "CAC: UDP recv error was \"%s\"\n", - SOCKERRSTR (errnoCpy) ); + if ( status == 0 ) { + return; } - else if ( status > 0 ) { - this->postMsg ( guard, src, this->recvBuf, - (arrayElementCount) status, epicsTime::getCurrent() ); + + int errnoCpy = SOCKERRNO; + + if ( errnoCpy == SOCK_SHUTDOWN ) { + return; } + if ( errnoCpy == SOCK_ENOTSOCK ) { + return; + } + if ( errnoCpy == SOCK_EBADF ) { + return; + } + if ( errnoCpy == SOCK_EINTR ) { + return; + } + // Avoid spurious ECONNREFUSED bug in linux + if ( errnoCpy == SOCK_ECONNREFUSED ) { + return; + } + // Avoid ECONNRESET from disconnected socket bug + // in windows + if ( errnoCpy == SOCK_ECONNRESET ) { + return; + } + this->printf ( "CAC: UDP recv error was \"%s\"\n", + SOCKERRSTR (errnoCpy) ); + } + else if ( status > 0 ) { + this->postMsg ( guard, src, this->recvBuf, + (arrayElementCount) status, epicsTime::getCurrent() ); } } @@ -311,11 +308,8 @@ void udpRecvThread::run () epicsThreadPrivateSet ( caClientCallbackThreadId, &this->iiu ); if ( ellCount ( & this->iiu.dest ) == 0 ) { // X aCC 392 - cacMessageProcessingMinder msgProcMinder ( this->iiu.cacRef ); - { - epicsGuard < callbackMutex > cbGuard ( this->cbMutex ); - genLocalExcep ( cbGuard, this->iiu.cacRef, ECA_NOSEARCHADDR, NULL ); - } + epicsGuard < callbackMutex > cbGuard ( this->cbMutex ); + genLocalExcep ( cbGuard, this->iiu.cacRef, ECA_NOSEARCHADDR, NULL ); } do {