From 61a4d8a0d325093ce269c85cf3787e0a17e68e3e Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 17 Jun 2004 23:26:18 +0000 Subject: [PATCH] protect against exceptions occurring when eliminating excessive send backlog o creating channel o creating subscription also eliminated redundant code from subscription destroy --- src/ca/access.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ca/access.cpp b/src/ca/access.cpp index 81a993d2a..e333c30b8 100644 --- a/src/ca/access.cpp +++ b/src/ca/access.cpp @@ -691,8 +691,13 @@ int epicsShareAPI ca_create_subscription ( try { epicsGuard < epicsMutex > guard ( pChan->getClientCtx().mutex ); - pChan->eliminateExcessiveSendBacklog ( - pChan->getClientCtx().pCallbackGuard.get(), guard ); + try { + pChan->eliminateExcessiveSendBacklog ( + pChan->getClientCtx().pCallbackGuard.get(), guard ); + } + catch ( cacChannel::notConnected & ) { + // intentionally ignored + } autoPtrFreeList < oldSubscription, 0x400, epicsMutexNOOP > pSubsr ( pChan->getClientCtx().subscriptionFreeList, new ( pChan->getClientCtx().subscriptionFreeList ) @@ -757,18 +762,13 @@ epicsShareFunc int epicsShareAPI ca_clear_subscription ( evid pMon ) { oldChannelNotify & chan = pMon->channel (); ca_client_context & cac = chan.getClientCtx (); - if ( cac.pCallbackGuard.get() ) { - epicsGuard < epicsMutex > guard ( cac.mutex ); - chan.eliminateExcessiveSendBacklog ( - cac.pCallbackGuard.get(), guard ); - pMon->ioCancel ( *cac.pCallbackGuard, guard ); + epicsGuard < epicsMutex > * pCBGuard = cac.pCallbackGuard.get(); + if ( pCBGuard ) { + cac.clearSubscriptionPrivate ( pMon, *pCBGuard ); } else { epicsGuard < epicsMutex > cbGuard ( cac.cbMutex ); - epicsGuard < epicsMutex > guard ( cac.mutex ); - chan.eliminateExcessiveSendBacklog ( - &cbGuard, guard ); - pMon->ioCancel ( cbGuard, guard ); + cac.clearSubscriptionPrivate ( pMon, cbGuard ); } return ECA_NORMAL; }