diff --git a/src/ca/Makefile b/src/ca/Makefile index b466b3789..5598f02f5 100644 --- a/src/ca/Makefile +++ b/src/ca/Makefile @@ -69,7 +69,6 @@ LIBSRCS += comQueSend.cpp LIBSRCS += comBuf.cpp LIBSRCS += hostNameCache.cpp LIBSRCS += msgForMultiplyDefinedPV.cpp -LIBSRCS += limboiiu.cpp LIBSRCS += callbackMutex.cpp LIBSRCS += templateInstances.cpp diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index ea17d45db..9384c285e 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -243,10 +243,12 @@ cac::~cac () // shutdown all tcp circuits // { + epicsGuard < callbackMutex > cbGuard ( this->cbMutex ); epicsGuard < cacMutex > guard ( this->mutex ); resTableIter < tcpiiu, caServerID > iter = this->serverTable.firstIter (); while ( iter.valid() ) { - iter->initiateCleanShutdown ( guard ); + // this causes a clean shutdown to occur + iter->removeAllChannels ( cbGuard, guard, *this ); iter++; } } diff --git a/src/ca/cacIO.h b/src/ca/cacIO.h index 1ebbfd84d..102b5a745 100644 --- a/src/ca/cacIO.h +++ b/src/ca/cacIO.h @@ -126,6 +126,7 @@ public: virtual ~cacChannelNotify () = 0; virtual void connectNotify () = 0; virtual void disconnectNotify () = 0; + virtual void serviceShutdownNotify () = 0; virtual void accessRightsNotify ( const caAccessRights & ) = 0; virtual void exception ( int status, const char *pContext ) = 0; // we should probably have a different vf for each type of exception ???? diff --git a/src/ca/limboiiu.cpp b/src/ca/limboiiu.cpp deleted file mode 100644 index f424f2059..000000000 --- a/src/ca/limboiiu.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. -\*************************************************************************/ - -/* - * $Id$ - * - * - * L O S A L A M O S - * Los Alamos National Laboratory - * Los Alamos, New Mexico 87545 - * - * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 - */ - -#define epicsAssertAuthor "Jeff Hill johill@lanl.gov" - -#define epicsExportSharedSymbols -#include "iocinf.h" -#include "netiiu.h" -#include "inetAddrID.h" - -limboiiu::limboiiu () -{ -} - -void limboiiu::hostName ( char *pBuf, unsigned bufLength ) const -{ - netiiu::hostName ( pBuf, bufLength ); -} - -const char * limboiiu::pHostName () const -{ - return netiiu::pHostName (); -} - -bool limboiiu::ca_v42_ok () const -{ - return netiiu::ca_v42_ok (); -} - -void limboiiu::writeRequest ( epicsGuard < cacMutex > & guard, nciu & chan, unsigned type, - unsigned nElem, const void * pValue ) -{ - netiiu::writeRequest ( guard, chan, type, nElem, pValue ); -} - -void limboiiu::writeNotifyRequest ( epicsGuard < cacMutex > & guard, nciu & chan, - netWriteNotifyIO & io, unsigned type, unsigned nElem, const void *pValue ) -{ - netiiu::writeNotifyRequest ( guard, chan, io, type, nElem, pValue ); -} - -void limboiiu::readNotifyRequest ( epicsGuard < cacMutex > & guard, nciu & chan, - netReadNotifyIO & io, unsigned type, unsigned nElem ) -{ - netiiu::readNotifyRequest ( guard, chan, io, type, nElem ); -} - -void limboiiu::clearChannelRequest ( epicsGuard < cacMutex > & guard, - ca_uint32_t sid, ca_uint32_t cid ) -{ - netiiu::clearChannelRequest ( guard, sid, cid ); -} - -void limboiiu::subscriptionRequest ( epicsGuard < cacMutex > & guard, nciu & chan, - netSubscription & subscr ) -{ - netiiu::subscriptionRequest ( guard, chan, subscr ); -} - -void limboiiu::subscriptionCancelRequest ( epicsGuard < cacMutex > & guard, - nciu & chan, netSubscription & subscr ) -{ - netiiu::subscriptionCancelRequest ( guard, chan, subscr ); -} - -void limboiiu::flushRequest () -{ - netiiu::flushRequest (); -} - -bool limboiiu::flushBlockThreshold ( epicsGuard < cacMutex > & guard ) const -{ - return netiiu::flushBlockThreshold ( guard ); -} - -void limboiiu::flushRequestIfAboveEarlyThreshold ( epicsGuard < cacMutex > & guard ) -{ - netiiu::flushRequestIfAboveEarlyThreshold ( guard ); -} - -void limboiiu::blockUntilSendBacklogIsReasonable - ( cacNotify & notify, epicsGuard < cacMutex > & guard ) -{ - netiiu::blockUntilSendBacklogIsReasonable ( notify, guard ); -} - -void limboiiu::requestRecvProcessPostponedFlush () -{ - netiiu::requestRecvProcessPostponedFlush (); -} - -osiSockAddr limboiiu::getNetworkAddress () const -{ - return netiiu::getNetworkAddress (); -} - -void limboiiu::uninstallChan ( epicsGuard < cacMutex > & guard, nciu & chan ) -{ - netiiu::uninstallChan( guard, chan ); -} - - - - - - diff --git a/src/ca/nciu.h b/src/ca/nciu.h index 9bbd7f707..b11d855fc 100644 --- a/src/ca/nciu.h +++ b/src/ca/nciu.h @@ -79,6 +79,7 @@ public: void * operator new ( size_t size ); void operator delete ( void *pCadaver, size_t size ); void beaconAnomalyNotify (); + void serviceShutdownNotify (); void accessRightsStateChange ( const caAccessRights & ); ca_uint32_t getSID () const; ca_uint32_t getCID () const; @@ -100,7 +101,7 @@ public: private: caAccessRights accessRightState; cac & cacCtx; - char * pNameStr; + const char * pNameStr; netiiu * piiu; ca_uint32_t sid; // server id unsigned count; @@ -214,6 +215,11 @@ inline const netiiu * nciu::getConstPIIU () const return this->piiu; } +inline void nciu::serviceShutdownNotify () +{ + this->notify().serviceShutdownNotify (); +} + inline cac & nciu::getClient () { return this->cacCtx; diff --git a/src/ca/netiiu.h b/src/ca/netiiu.h index a6048ea6c..93048d9ba 100644 --- a/src/ca/netiiu.h +++ b/src/ca/netiiu.h @@ -68,35 +68,4 @@ public: virtual void uninstallChan ( epicsGuard < cacMutex > &, nciu & ) = 0; }; -class limboiiu : public netiiu { // X aCC 655 -public: - limboiiu (); -private: - void hostName ( char *pBuf, unsigned bufLength ) const; - const char * pHostName () const; // deprecated - please do not use - bool ca_v42_ok () const; - void writeRequest ( epicsGuard < cacMutex > &, nciu &, - unsigned type, unsigned nElem, const void *pValue ); - void writeNotifyRequest ( epicsGuard < cacMutex > &, nciu &, netWriteNotifyIO &, - unsigned type, unsigned nElem, const void *pValue ); - void readNotifyRequest ( epicsGuard < cacMutex > &, nciu &, netReadNotifyIO &, - unsigned type, unsigned nElem ); - void clearChannelRequest ( epicsGuard < cacMutex > &, - ca_uint32_t sid, ca_uint32_t cid ); - void subscriptionRequest ( epicsGuard < cacMutex > &, nciu &, - netSubscription &subscr ); - void subscriptionCancelRequest ( epicsGuard < cacMutex > &, - nciu & chan, netSubscription & subscr ); - void flushRequest (); - bool flushBlockThreshold ( epicsGuard < cacMutex > & ) const; - void flushRequestIfAboveEarlyThreshold ( epicsGuard < cacMutex > & ); - void blockUntilSendBacklogIsReasonable - ( cacNotify &, epicsGuard < cacMutex > & ); - void requestRecvProcessPostponedFlush (); - osiSockAddr getNetworkAddress () const; - void uninstallChan ( epicsGuard < cacMutex > &, nciu & ); - limboiiu ( const limboiiu & ); - limboiiu & operator = ( const limboiiu & ); -}; - #endif // netiiuh diff --git a/src/ca/oldAccess.h b/src/ca/oldAccess.h index 3f8956913..2b25a3343 100644 --- a/src/ca/oldAccess.h +++ b/src/ca/oldAccess.h @@ -99,6 +99,7 @@ private: bool prevConnected; void connectNotify (); void disconnectNotify (); + void serviceShutdownNotify (); void accessRightsNotify ( const caAccessRights & ); void exception ( int status, const char *pContext ); void readException ( int status, const char *pContext, diff --git a/src/ca/oldChannelNotify.cpp b/src/ca/oldChannelNotify.cpp index a29a013ac..63ba8dc46 100644 --- a/src/ca/oldChannelNotify.cpp +++ b/src/ca/oldChannelNotify.cpp @@ -150,6 +150,11 @@ void oldChannelNotify::disconnectNotify () } } +void oldChannelNotify::serviceShutdownNotify () +{ + delete this; +} + void oldChannelNotify::accessRightsNotify ( const caAccessRights &ar ) { struct access_rights_handler_args args; diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index cf918b488..70b0f538d 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -650,11 +650,6 @@ void tcpiiu::initiateAbortShutdown ( epicsGuard < callbackMutex > & cbGuard, // tcpiiu::~tcpiiu () { - { - epicsGuard < cacMutex > guard ( this->cacRef.mutexRef() ); - this->initiateCleanShutdown ( guard ); - } - this->sendThread.exitWait (); this->recvThread.exitWait (); @@ -1247,7 +1242,6 @@ void tcpiiu::removeAllChannels ( epicsGuard < callbackMutex > & cbGuard, epicsGuard < cacMutex > & guard, cacDisconnectChannelPrivate & dcp ) { - // we are protected here because channel delete takes the callback mutex while ( nciu *pChan = this->channelList.first() ) { // if the claim reply has not returned then we will issue // the clear channel request to the server when the claim reply diff --git a/src/ca/udpiiu.cpp b/src/ca/udpiiu.cpp index d47469c48..4a7951fee 100644 --- a/src/ca/udpiiu.cpp +++ b/src/ca/udpiiu.cpp @@ -189,10 +189,14 @@ udpiiu::~udpiiu () { this->shutdown (); - static limboiiu limboIIU; - while ( nciu * pChan = this->channelList.get () ) { - // no need to own CAC lock here because the channel is being decomissioned - pChan->disconnect ( limboIIU ); + // no need to own CAC lock here because the CA context + // is being decomissioned + tsDLIter < nciu > chan = this->channelList.firstIter (); + while ( chan.valid () ) { + tsDLIter < nciu > next = chan; + next++; + chan->serviceShutdownNotify (); + chan = next; } // avoid use of ellFree because problems on windows occur if the