From dc5f217493d993ca89e2f900c39062708dbd096f Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 11 Dec 2002 02:11:16 +0000 Subject: [PATCH] simplified --- src/ca/cac.cpp | 16 ++++++---------- src/ca/udpiiu.cpp | 22 ++++++++++++---------- src/ca/udpiiu.h | 1 - 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index c93b66bb0..c0a2802c6 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -518,7 +518,7 @@ bool cac::lookupChannelAndTransferToTCP ( */ pChan = this->chanTable.lookup ( cid ); if ( ! pChan ) { - return true; + return false; } /* @@ -533,7 +533,7 @@ bool cac::lookupChannelAndTransferToTCP ( msgForMultiplyDefinedPV ( *this, pChan->pName (), acc, addr ); pMsg->ioInitiate ( this->ipToAEngine ); } - return true; + return false; } /* @@ -543,7 +543,7 @@ bool cac::lookupChannelAndTransferToTCP ( piiu = this->serverTable.lookup ( servID ); if ( piiu ) { if ( ! piiu->alive () ) { - return true; + return false; } } else { @@ -557,7 +557,7 @@ bool cac::lookupChannelAndTransferToTCP ( pBHE = new ( this->bheFreeList ) bhe ( epicsTime (), 0u, addr.ia ); if ( this->beaconTable.add ( *pBHE ) < 0 ) { - return true; + return false; } } this->serverTable.add ( *pnewiiu ); @@ -566,11 +566,11 @@ bool cac::lookupChannelAndTransferToTCP ( newIIU = true; } catch ( std::bad_alloc & ) { - return true; + return false; } catch ( ... ) { this->printf ( "CAC: Unexpected exception during virtual circuit creation\n" ); - return true; + return false; } } @@ -614,10 +614,6 @@ bool cac::lookupChannelAndTransferToTCP ( piiu->start ( cbGuard ); } - if ( this->pudpiiu ) { - this->pudpiiu->notifySearchResponse ( currentTime ); - } - return true; } diff --git a/src/ca/udpiiu.cpp b/src/ca/udpiiu.cpp index 67617f21e..5a9f5987c 100644 --- a/src/ca/udpiiu.cpp +++ b/src/ca/udpiiu.cpp @@ -639,16 +639,26 @@ bool udpiiu::searchRespAction ( // X aCC 361 serverAddr.ia.sin_addr = addr.ia.sin_addr; } + bool success; if ( CA_V42 ( minorVersion ) ) { - return this->cacRef.lookupChannelAndTransferToTCP + success = this->cacRef.lookupChannelAndTransferToTCP ( cbLocker, msg.m_available, msg.m_cid, 0xffff, 0, minorVersion, serverAddr, currentTime ); } else { - return this->cacRef.lookupChannelAndTransferToTCP + success = this->cacRef.lookupChannelAndTransferToTCP ( cbLocker, msg.m_available, msg.m_cid, msg.m_dataType, msg.m_count, minorVersion, serverAddr, currentTime ); } + + if ( success ) { + // deadlock can result if this is called while holding the primary + // mutex (because the primary mutex is used in the search timer callback) + this->pSearchTmr->notifySearchResponse ( this->lastReceivedSeqNo, + this->lastReceivedSeqNoIsValid, currentTime ); + } + + return true; } bool udpiiu::beaconAction ( epicsGuard < callbackMutex > &, const caHdr &msg, @@ -992,14 +1002,6 @@ void udpiiu::repeaterConfirmNotify () this->pRepeaterSubscribeTmr->confirmNotify (); } -void udpiiu::notifySearchResponse ( const epicsTime & currentTime ) -{ - // deadlock can result if this is called while holding the primary - // mutex (because the primary mutex is used in the search timer callback) - this->pSearchTmr->notifySearchResponse ( this->lastReceivedSeqNo, - this->lastReceivedSeqNoIsValid, currentTime ); -} - void udpiiu::beaconAnomalyNotify () { { diff --git a/src/ca/udpiiu.h b/src/ca/udpiiu.h index 31d7f6c4b..883c6cad6 100644 --- a/src/ca/udpiiu.h +++ b/src/ca/udpiiu.h @@ -91,7 +91,6 @@ public: void show ( unsigned level ) const; bool wakeupMsg (); void repeaterConfirmNotify (); - void notifySearchResponse ( const epicsTime & currentTime ); void beaconAnomalyNotify (); int printf ( const char *pformat, ... ); unsigned channelCount () const;