Fixed issue "TCP Nameserver Connection Down Blocks All Callbacks" and cleaned up the SearchDest list / TCP circuit relation

* Pulled out tcpiiu::SearchDestTCP to have cac create the SearchDest independent from the TCP circuit
* Reorganized the relation between the SearchDestTCP and the TCP circuit:
  - SearchDest stays always on the cac list
  - TCP connection going down sets SearchDest inactive and SearchDestTCP's circuit member to NULL
  - Next seach request creates the new TCP circuit and sets SearchDestTCP's member, but leaves SearchDest inactive
  - Successful connect sets SearchDest active
* ReceiveThread releases the cac mutex before going to sleep in connect loop
This commit is contained in:
Ralph Lange
2010-04-15 17:06:16 -04:00
parent a0e868e2e1
commit be978d6499
4 changed files with 72 additions and 50 deletions

View File

@@ -258,9 +258,11 @@ cac::cac (
while ( osiSockAddrNode *
pNode = reinterpret_cast < osiSockAddrNode * > ( ellGet ( & dest ) ) ) {
tcpiiu * piiu = NULL;
SearchDestTCP * pdst = new SearchDestTCP ( *this, pNode->addr );
this->registerSearchDest ( guard, * pdst );
bool newIIU = findOrCreateVirtCircuit (
guard, pNode->addr, cacChannel::priorityDefault,
piiu, CA_UKN_MINOR_VERSION, true );
piiu, CA_UKN_MINOR_VERSION, pdst );
free ( pNode );
if ( newIIU ) {
piiu->start ( guard );
@@ -513,7 +515,7 @@ cacChannel & cac::createChannel (
bool cac::findOrCreateVirtCircuit (
epicsGuard < epicsMutex > & guard, const osiSockAddr & addr,
unsigned priority, tcpiiu *& piiu, unsigned minorVersionNumber,
const bool nameService )
SearchDestTCP * pSearchDest )
{
guard.assertIdenticalMutex ( this->mutex );
bool newIIU = false;
@@ -530,7 +532,7 @@ bool cac::findOrCreateVirtCircuit (
new ( this->freeListVirtualCircuit ) tcpiiu (
*this, this->mutex, this->cbMutex, this->notify, this->connTMO,
this->timerQueue, addr, this->comBufMemMgr, minorVersionNumber,
this->ipToAEngine, priority, nameService ) );
this->ipToAEngine, priority, pSearchDest ) );
bhe * pBHE = this->beaconTable.lookup ( addr.ia );
if ( ! pBHE ) {