diff --git a/src/ca/bhe.cpp b/src/ca/bhe.cpp index 9a3036053..8b2bffe44 100644 --- a/src/ca/bhe.cpp +++ b/src/ca/bhe.cpp @@ -15,9 +15,18 @@ tsFreeList < class bhe, 1024 > bhe::freeList; +void * bhe::operator new ( size_t size ) +{ + return bhe::freeList.allocate ( size ); +} + +void bhe::operator delete ( void *pCadaver, size_t size ) +{ + bhe::freeList.release ( pCadaver, size ); +} + bhe::~bhe () { - this->cac.removeBeaconInetAddr (*this); } /* @@ -25,7 +34,7 @@ bhe::~bhe () * * updates beacon period, and looks for beacon anomalies */ -bool bhe::updateBeaconPeriod (osiTime programBeginTime) +bool bhe::updateBeaconPeriod ( osiTime programBeginTime ) { double currentPeriod; bool netChange = false; @@ -149,7 +158,7 @@ void bhe::show ( unsigned level ) const { printf ( "CA beacon hash entry at %p with average period %f\n", this, this->averagePeriod ); if ( level > 0u ) { - printf ( "network IO pointer %p, client pointer %p\n", this->piiu, &this->cac ); + printf ( "network IO pointer %p\n", this->piiu ); } } diff --git a/src/ca/bhe_IL.h b/src/ca/bhe_IL.h index 779229e0f..bc8c19f9a 100644 --- a/src/ca/bhe_IL.h +++ b/src/ca/bhe_IL.h @@ -25,8 +25,8 @@ * zero (so we can correctly compute the period * between the 1st and 2nd beacons) */ -inline bhe::bhe ( class cac &cacIn, const osiTime &initialTimeStamp, const inetAddrID &addr ) : - inetAddrID (addr), cac (cacIn), piiu (0), timeStamp (initialTimeStamp), averagePeriod (-1.0) +inline bhe::bhe ( const osiTime &initialTimeStamp, const inetAddrID &addr ) : + inetAddrID (addr), piiu (0), timeStamp (initialTimeStamp), averagePeriod (-1.0) { # ifdef DEBUG { @@ -37,16 +37,6 @@ inline bhe::bhe ( class cac &cacIn, const osiTime &initialTimeStamp, const inetA # endif } -inline void * bhe::operator new ( size_t size ) -{ - return bhe::freeList.allocate ( size ); -} - -inline void bhe::operator delete ( void *pCadaver, size_t size ) -{ - bhe::freeList.release ( pCadaver, size ); -} - inline tcpiiu *bhe::getIIU ()const { return this->piiu; diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index d229a6907..503129cda 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -221,10 +221,9 @@ cac::~cac () if ( this->pUserName ) { delete [] this->pUserName; } - - this->sgTable.destroyAllEntries (); - this->beaconTable.destroyAllEntries (); - this->chanTable.destroyAllEntries (); + this->sgTable.traverse ( CASG::destroy ); + this->beaconTable.traverse ( bhe::destroy ); + this->chanTable.traverse ( nciu::destroy ); osiSockRelease (); @@ -262,6 +261,7 @@ void cac::processRecvBacklog () this->iiuListLimbo.add ( *piiu ); if ( pBHE ) { + this->beaconTable.remove ( *pBHE ); pBHE->destroy (); } @@ -402,9 +402,9 @@ bhe *cac::createBeaconHashEntry (const inetAddrID &ina, const osiTime &initialTi pBHE = this->beaconTable.lookup ( ina ); if ( !pBHE ) { - pBHE = new bhe (*this, initialTimeStamp, ina); + pBHE = new bhe ( initialTimeStamp, ina ); if ( pBHE ) { - if ( this->beaconTable.add (*pBHE) < 0 ) { + if ( this->beaconTable.add ( *pBHE ) < 0 ) { pBHE->destroy (); pBHE = 0; } @@ -500,18 +500,6 @@ void cac::beaconNotify ( const inetAddrID &addr ) } -/* - * cac::removeBeaconInetAddr () - */ -void cac::removeBeaconInetAddr (const inetAddrID &ina) -{ - osiAutoMutex autoMutex ( this->defaultMutex ); - bhe *pBHE; - - pBHE = this->beaconTable.remove ( ina ); - assert (pBHE); -} - int cac::pend ( double timeout, int early ) { int status;