changed list interface

This commit is contained in:
Jeff Hill
2001-02-15 17:26:50 +00:00
parent 9e52a5b095
commit 33fa1b7ff8
24 changed files with 289 additions and 523 deletions
+4 -3
View File
@@ -47,10 +47,10 @@ CASG::~CASG ()
{
if ( this->verify () ) {
this->mutex.lock ();
tsDLIterBD <syncGroupNotify> notify ( this->ioList.first () );
tsDLIterBD <syncGroupNotify> notify = this->ioList.firstIter ();
while ( notify.valid () ) {
notify->release ();
notify = this->ioList.first ();
notify = this->ioList.firstIter ();
}
this->mutex.unlock ();
this->client.uninstallCASG ( *this );
@@ -160,9 +160,10 @@ void CASG::show ( unsigned level) const
if ( level ) {
this->mutex.lock ();
tsDLIterBD <syncGroupNotify> notify ( this->ioList.first () );
tsDLIterConstBD <syncGroupNotify> notify = this->ioList.firstIter ();
while ( notify.valid () ) {
notify->show (level);
notify++;
}
this->mutex.unlock ();
}
+11 -8
View File
@@ -156,9 +156,10 @@ cac::~cac ()
{
epicsAutoMutex autoMutex ( this->iiuListMutex );
tsDLIterBD <tcpiiu> piiu ( this->iiuList.first () );
tsDLIterBD <tcpiiu> piiu = this->iiuList.firstIter ();
while ( piiu.valid () ) {
tsDLIterBD <tcpiiu> pnext = piiu.itemAfter ();
tsDLIterBD <tcpiiu> pnext = piiu;
pnext++;
{
epicsAutoMutex autoMutexTmp ( this->defaultMutex );
piiu->disconnectAllChan ( limboIIU );
@@ -168,9 +169,10 @@ cac::~cac ()
piiu = pnext;
}
piiu = this->iiuListLimbo.first ();
piiu = this->iiuListLimbo.firstIter ();
while ( piiu.valid () ) {
tsDLIterBD <tcpiiu> pnext = piiu.itemAfter ();
tsDLIterBD <tcpiiu> pnext = piiu;
pnext++;
piiu->suicide ();
piiu = pnext;
}
@@ -220,9 +222,10 @@ void cac::processRecvBacklog ()
{
epicsAutoMutex autoMutex ( this->iiuListMutex );
tsDLIterBD < tcpiiu > piiu ( this->iiuList.first () );
tsDLIterBD < tcpiiu > piiu = this->iiuList.firstIter ();
while ( piiu.valid () ) {
tsDLIterBD < tcpiiu > pNext = piiu.itemAfter ();
tsDLIterBD < tcpiiu > pNext = piiu;
pNext++;
if ( ! piiu->alive () ) {
assert ( this->pudpiiu && this->pSearchTmr );
@@ -271,7 +274,7 @@ void cac::flush ()
* set the push pending flag on all virtual circuits
*/
epicsAutoMutex autoMutex ( this->iiuListMutex );
tsDLIterBD <tcpiiu> piiu ( this->iiuList.first () );
tsDLIterBD <tcpiiu> piiu = this->iiuList.firstIter ();
while ( piiu.valid () ) {
piiu->flush ();
piiu++;
@@ -292,7 +295,7 @@ void cac::show ( unsigned level ) const
::printf ( "Channel Access Client Context at %p for user %s\n",
this, this->pUserName );
if ( level > 0u ) {
tsDLIterConstBD < tcpiiu > piiu ( this->iiuList.first () );
tsDLIterConstBD < tcpiiu > piiu = this->iiuList.firstIter ();
while ( piiu.valid () ) {
piiu->show ( level - 1u );
piiu++;
+2 -2
View File
@@ -36,7 +36,7 @@ cacChannelIO * cacServiceList::createChannelIO ( const char *pName,
cacChannelIO *pChanIO = 0;
this->lock ();
tsDLIterBD < cacServiceIO > iter ( this->services.first () );
tsDLIterBD < cacServiceIO > iter = this->services.firstIter ();
while ( iter.valid () ) {
pChanIO = iter->createChannelIO ( pName, cacCtx, chan );
if ( pChanIO ) {
@@ -52,7 +52,7 @@ cacChannelIO * cacServiceList::createChannelIO ( const char *pName,
void cacServiceList::show ( unsigned level ) const
{
this->lock ();
tsDLIterConstBD < cacServiceIO > iter ( this->services.first () );
tsDLIterConstBD < cacServiceIO > iter = this->services.firstIter ();
while ( iter.valid () ) {
iter->show ( level );
iter++;
+1 -1
View File
@@ -15,7 +15,7 @@ inline inetAddrID::inetAddrID (const struct sockaddr_in &addrIn) :
{
}
inline bool inetAddrID::operator == (const inetAddrID &rhs)
inline bool inetAddrID::operator == (const inetAddrID &rhs) const
{
if (this->addr.sin_addr.s_addr == rhs.addr.sin_addr.s_addr) {
if (this->addr.sin_port == rhs.addr.sin_port) {
+1 -1
View File
@@ -865,7 +865,7 @@ private:
class inetAddrID {
public:
inetAddrID ( const struct sockaddr_in &addrIn );
bool operator == ( const inetAddrID & );
bool operator == ( const inetAddrID & ) const;
resTableIndex hash ( unsigned nBitsHashIndex ) const;
static unsigned maxIndexBitWidth ();
static unsigned minIndexBitWidth ();
+12 -11
View File
@@ -32,10 +32,10 @@ void netiiu::show ( unsigned level ) const
printf ( "network IO base class\n" );
if ( level > 1 ) {
tsDLIterConstBD < nciu > pChan ( this->channelList.first () );
tsDLIterConstBD < nciu > pChan = this->channelList.firstIter ();
while ( pChan.valid () ) {
pChan->show ( level - 1u );
pChan = pChan.itemAfter ();
pChan++;
}
}
if ( level > 2u ) {
@@ -78,9 +78,10 @@ void netiiu::disconnectAllChan ( netiiu & newiiu )
{
epicsAutoMutex autoMutex ( this->mutex );
tsDLIterBD < nciu > chan ( this->channelList.first () );
tsDLIterBD < nciu > chan = this->channelList.firstIter ();
while ( chan.valid () ) {
tsDLIterBD < nciu > next = chan.itemAfter ();
tsDLIterBD < nciu > next = chan;
next++;
this->clearChannelRequest ( *chan );
this->channelList.remove ( *chan );
chan->disconnect ( newiiu );
@@ -123,7 +124,7 @@ bool netiiu::destroyAllIO ( nciu &chan )
void netiiu::connectTimeoutNotify ()
{
epicsAutoMutex autoMutex ( this->mutex );
tsDLIterBD < nciu > chan ( this->channelList.first () );
tsDLIterBD < nciu > chan = this->channelList.firstIter ();
while ( chan.valid () ) {
chan->connectTimeoutNotify ();
chan++;
@@ -133,7 +134,7 @@ void netiiu::connectTimeoutNotify ()
void netiiu::resetChannelRetryCounts ()
{
epicsAutoMutex autoMutex ( this->mutex );
tsDLIterBD < nciu > chan ( this->channelList.first () );
tsDLIterBD < nciu > chan = this->channelList.firstIter ();
while ( chan.valid () ) {
chan->resetRetryCount ();
chan++;
@@ -146,12 +147,12 @@ bool netiiu::searchMsg ( unsigned short retrySeqNumber, unsigned &retryNoForThis
epicsAutoMutex autoMutex ( this->mutex );
tsDLIterBD < nciu > chan = this->channelList.first ();
if ( chan.valid () ) {
status = chan->searchMsg ( retrySeqNumber, retryNoForThisChannel );
nciu *pChan = this->channelList.first ();
if ( pChan ) {
status = pChan->searchMsg ( retrySeqNumber, retryNoForThisChannel );
if ( status ) {
this->channelList.remove ( *chan );
this->channelList.add ( *chan );
this->channelList.remove ( *pChan );
this->channelList.add ( *pChan );
}
}
else {
+16 -14
View File
@@ -412,33 +412,35 @@ LOCAL void register_new_client ( osiSockAddr &from )
}
}
tsDLIterBD < repeaterClient > pclient = client_list.first ();
tsDLIterBD < repeaterClient > pclient = client_list.firstIter ();
while ( pclient.valid () ) {
if ( pclient->identicalPort ( from ) ) {
break;
}
pclient = pclient.itemAfter ();
}
if ( ! pclient.valid () ) {
pclient = new repeaterClient ( from );
if ( ! pclient.valid () ) {
pclient++;
}
repeaterClient *pNewClient;
if ( pclient.valid () ) {
pNewClient = pclient.pointer ();
}
else {
repeaterClient *pNewClient = new repeaterClient ( from );
if ( ! pNewClient ) {
ca_printf ( "%s: no memory for new client\n", __FILE__ );
return;
}
if ( ! pclient->connect () ) {
if ( ! pNewClient->connect () ) {
pclient->destroy ();
return;
}
client_list.add ( *pclient );
client_list.add ( *pNewClient );
newClient = true;
}
if ( ! pclient->sendConfirm () ) {
client_list.remove (*pclient );
pclient->destroy ();
if ( ! pNewClient->sendConfirm () ) {
client_list.remove ( *pNewClient );
pNewClient->destroy ();
debugPrintf ( ( "Deleted repeater client=%u (error while sending ack)\n",
ntohs (from.ia.sin_port) ) );
}
+6 -4
View File
@@ -1958,9 +1958,10 @@ void tcpiiu::connectAllIO ( nciu &chan )
epicsAutoMutex autoMutex ( this->mutex );
if ( chan.verifyConnected ( *this ) ) {
tsDLIterBD < baseNMIU > pNetIO =
chan.tcpiiuPrivateListOfIO::eventq.first ();
chan.tcpiiuPrivateListOfIO::eventq.firstIter ();
while ( pNetIO.valid () ) {
tsDLIterBD < baseNMIU > next = pNetIO.itemAfter ();
tsDLIterBD < baseNMIU > next = pNetIO;
next++;
class netSubscription *pSubscr = pNetIO->isSubscription ();
if ( pSubscr ) {
this->subscriptionRequest ( *pSubscr, false );
@@ -1984,9 +1985,10 @@ void tcpiiu::disconnectAllIO ( nciu &chan )
epicsAutoMutex autoMutex ( this->mutex );
if ( chan.verifyConnected ( *this ) ) {
tsDLIterBD < baseNMIU > pNetIO =
chan.tcpiiuPrivateListOfIO::eventq.first ();
chan.tcpiiuPrivateListOfIO::eventq.firstIter ();
while ( pNetIO.valid () ) {
tsDLIterBD < baseNMIU > next = pNetIO.itemAfter ();
tsDLIterBD < baseNMIU > next = pNetIO;
next++;
class netSubscription *pSubscr = pNetIO->isSubscription ();
this->ioTable.remove ( *pNetIO );
if ( pSubscr ) {