diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index b0cd0a230..216fe946d 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -217,15 +217,15 @@ cac::cac ( cacNotify & notifyIn, bool enablePreemptiveCallbackIn ) : cac::~cac () { + // this blocks until the UDP thread exits so that + // it will not sneak in any new clients // // lock intentionally not held here so that we dont deadlock // waiting for the UDP thread to exit while it is waiting to // get the lock. - - // this blocks until the UDP thread exits so that - // it will not sneak in any new clients - delete this->pudpiiu; - this->pudpiiu = 0; // for initiateAbortShutdown() + if ( this->pudpiiu ) { + this->pudpiiu->shutdown (); + } // // shutdown all tcp connections @@ -254,6 +254,10 @@ cac::~cac () this->iiuUninstall.wait (); } + if ( this->pudpiiu ) { + delete this->pudpiiu; + } + freeListCleanup ( this->tcpSmallRecvBufFreeList ); freeListCleanup ( this->tcpLargeRecvBufFreeList );