made lib more robust if server sends duplicate connect channel response
This commit is contained in:
@@ -1046,9 +1046,16 @@ bool cac::createChannelRespAction (
|
||||
else {
|
||||
sidTmp = pChan->getSID (guard);
|
||||
}
|
||||
iiu.connectNotify ( guard, *pChan );
|
||||
pChan->connect ( hdr.m_dataType, hdr.m_count, sidTmp,
|
||||
mgr.cbGuard, guard );
|
||||
bool wasExpected = iiu.connectNotify ( guard, *pChan );
|
||||
if ( wasExpected ) {
|
||||
pChan->connect ( hdr.m_dataType, hdr.m_count, sidTmp,
|
||||
mgr.cbGuard, guard );
|
||||
}
|
||||
else {
|
||||
errlogPrintf (
|
||||
"CA Client Library: Ignored duplicate create channel "
|
||||
"response from CA server?\n" );
|
||||
}
|
||||
}
|
||||
else if ( iiu.ca_v44_ok ( guard ) ) {
|
||||
// this indicates a claim response for a resource that does
|
||||
|
||||
@@ -1916,24 +1916,28 @@ void tcpiiu::nameResolutionMsgEndNotify ()
|
||||
}
|
||||
}
|
||||
|
||||
void tcpiiu::connectNotify (
|
||||
bool tcpiiu :: connectNotify (
|
||||
epicsGuard < epicsMutex > & guard, nciu & chan )
|
||||
{
|
||||
guard.assertIdenticalMutex ( this->mutex );
|
||||
bool wasExpected = false;
|
||||
// this improves robustness in the face of a server sending
|
||||
// protocol that does not match its declared protocol revision
|
||||
if ( chan.channelNode::listMember == channelNode::cs_createRespPend ) {
|
||||
this->createRespPend.remove ( chan );
|
||||
this->subscripReqPend.add ( chan );
|
||||
chan.channelNode::listMember = channelNode::cs_subscripReqPend;
|
||||
wasExpected = true;
|
||||
}
|
||||
else if ( chan.channelNode::listMember == channelNode::cs_v42ConnCallbackPend ) {
|
||||
this->v42ConnCallbackPend.remove ( chan );
|
||||
this->subscripReqPend.add ( chan );
|
||||
chan.channelNode::listMember = channelNode::cs_subscripReqPend;
|
||||
wasExpected = true;
|
||||
}
|
||||
// the TCP send thread is awakened by its receive thread whenever the receive thread
|
||||
// is about to block if this->subscripReqPend has items in it
|
||||
return wasExpected;
|
||||
}
|
||||
|
||||
void tcpiiu::uninstallChan (
|
||||
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
unsigned sidIn, ca_uint16_t typeIn, arrayElementCount countIn );
|
||||
void uninstallChan (
|
||||
epicsGuard < epicsMutex > & guard, nciu & chan );
|
||||
void connectNotify (
|
||||
bool connectNotify (
|
||||
epicsGuard < epicsMutex > &, nciu & chan );
|
||||
void nameResolutionMsgEndNotify ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user