From 36292e8c37f8840970409b82937bbc6830a28f93 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 17 Jan 2003 01:20:31 +0000 Subject: [PATCH] replace server list with server pointer --- src/ca/bhe.cpp | 30 ++++++++++++++---------------- src/ca/bhe.h | 4 ++-- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/ca/bhe.cpp b/src/ca/bhe.cpp index 8c9467e91..6fe5bd9cb 100644 --- a/src/ca/bhe.cpp +++ b/src/ca/bhe.cpp @@ -47,7 +47,7 @@ bhe::bhe ( const epicsTime & initialTimeStamp, unsigned initialBeaconNumber, const inetAddrID & addr ) epicsThrows (()) : inetAddrID ( addr ), timeStamp ( initialTimeStamp ), averagePeriod ( - DBL_MAX ), - lastBeaconNumber ( initialBeaconNumber ) + pIIU ( 0 ), lastBeaconNumber ( initialBeaconNumber ) { # ifdef DEBUG { @@ -64,10 +64,8 @@ bhe::~bhe () void bhe::beaconAnomalyNotify () { - tsDLIter < tcpiiu > iter = this->iiuList.firstIter (); - while ( iter.valid() ) { - iter->beaconAnomalyNotify (); - iter++; + if ( this->pIIU ) { + this->pIIU->beaconAnomalyNotify (); } } @@ -198,14 +196,10 @@ bool bhe::updatePeriod ( const epicsTime & programBeginTime, this->beaconAnomalyNotify (); netChange = true; } - else { + else if ( this->pIIU ) { // update state of health for active virtual circuits // if the beacon looks ok - tsDLIter < tcpiiu > iter = this->iiuList.firstIter (); - while ( iter.valid() ) { - iter->beaconArrivalNotify (); - iter++; - } + this->pIIU->beaconArrivalNotify (); } // update a running average period @@ -234,16 +228,20 @@ epicsTime bhe::updateTime () const return this->timeStamp; } -void bhe::registerIIU ( tcpiiu & iiu ) +void bhe::registerIIU ( tcpiiu & iiu, const epicsTime & currentTime ) { - this->iiuList.add ( iiu ); + this->pIIU = & iiu; + this->timeStamp = currentTime; + this->averagePeriod = - DBL_MAX; } void bhe::unregisterIIU ( tcpiiu & iiu ) { - this->iiuList.remove ( iiu ); - this->timeStamp = epicsTime(); - this->averagePeriod = - DBL_MAX; + if ( this->pIIU == & iiu ) { + this->pIIU = 0; + this->timeStamp = epicsTime(); + this->averagePeriod = - DBL_MAX; + } } void * bhe::operator new ( size_t ) // X aCC 361 diff --git a/src/ca/bhe.h b/src/ca/bhe.h index 6a8d7f83a..eeec474ba 100644 --- a/src/ca/bhe.h +++ b/src/ca/bhe.h @@ -65,16 +65,16 @@ public: epicsShareFunc double period () const epicsThrows (()); epicsShareFunc epicsTime updateTime () const; epicsShareFunc void show ( unsigned level) const; - epicsShareFunc void registerIIU ( tcpiiu & ); + epicsShareFunc void registerIIU ( tcpiiu &, const epicsTime & ); epicsShareFunc void unregisterIIU ( tcpiiu & ); epicsShareFunc void * operator new ( size_t size, bheMemoryManager & ); #ifdef CXX_PLACEMENT_DELETE epicsShareFunc void operator delete ( void *, bheMemoryManager & ) epicsThrows (()); #endif private: - tsDLList < tcpiiu > iiuList; epicsTime timeStamp; double averagePeriod; + tcpiiu * pIIU; ca_uint32_t lastBeaconNumber; void beaconAnomalyNotify (); bhe ( const bhe & );