improved disconnect search interval
This commit is contained in:
@@ -1407,7 +1407,7 @@ void cac::disconnectChannel (
|
||||
this->disconnectAllIO ( guard, chan, true );
|
||||
chan.getPIIU()->uninstallChan ( guard, chan );
|
||||
chan.disconnect ( *this->pudpiiu );
|
||||
this->pudpiiu->installChannel ( currentTime, chan );
|
||||
this->pudpiiu->installDisconnectedChannel ( currentTime, chan );
|
||||
epicsGuardRelease < cacMutex > autoMutexRelease ( guard );
|
||||
chan.connectStateNotify ( cbGuard );
|
||||
chan.accessRightsNotify ( cbGuard );
|
||||
@@ -1575,7 +1575,7 @@ double cac::beaconPeriod ( const nciu & chan ) const
|
||||
void cac::initiateConnect ( nciu & chan )
|
||||
{
|
||||
assert ( this->pudpiiu );
|
||||
this->pudpiiu->installChannel (
|
||||
this->pudpiiu->installNewChannel (
|
||||
epicsTime::getCurrent(), chan );
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ void nciu::connect ( unsigned nativeType,
|
||||
void nciu::disconnect ( netiiu & newiiu )
|
||||
{
|
||||
this->piiu = & newiiu;
|
||||
this->retry = 0u;
|
||||
this->retry = disconnectRetrySetpoint;
|
||||
this->typeCode = USHRT_MAX;
|
||||
this->count = 0u;
|
||||
this->sid = UINT_MAX;
|
||||
|
||||
@@ -67,10 +67,11 @@ searchTimer::~searchTimer ()
|
||||
}
|
||||
|
||||
void searchTimer::newChannelNotify (
|
||||
epicsGuard < udpMutex > & guard, const epicsTime & currentTime, bool firstChannel )
|
||||
epicsGuard < udpMutex > & guard, const epicsTime & currentTime,
|
||||
bool firstChannel, unsigned minRetryNo )
|
||||
{
|
||||
if ( firstChannel ) {
|
||||
this->recomputeTimerPeriod ( guard, 0 );
|
||||
this->recomputeTimerPeriod ( guard, minRetryNo );
|
||||
double newPeriod = this->period;
|
||||
{
|
||||
// avoid timer cancel block deadlock
|
||||
@@ -79,7 +80,8 @@ void searchTimer::newChannelNotify (
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->recomputeTimerPeriodAndStartTimer ( guard, currentTime, 0, 0.0 );
|
||||
this->recomputeTimerPeriodAndStartTimer ( guard,
|
||||
currentTime, minRetryNo, 0.0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@ public:
|
||||
ca_uint32_t respDatagramSeqNo,
|
||||
bool seqNumberIsValid, const epicsTime & currentTime );
|
||||
void newChannelNotify ( epicsGuard < udpMutex > &,
|
||||
const epicsTime & currentTime, bool firstChannel );
|
||||
const epicsTime &, bool firstChannel,
|
||||
unsigned minRetryNo );
|
||||
void beaconAnomalyNotify ( epicsGuard < udpMutex > &,
|
||||
const epicsTime & currentTime, const double & delay );
|
||||
void show ( unsigned level ) const;
|
||||
|
||||
@@ -1044,11 +1044,12 @@ bool udpiiu::searchMsg ( epicsGuard < udpMutex > & /* guard */,
|
||||
return success;
|
||||
}
|
||||
|
||||
void udpiiu::installChannel ( const epicsTime & currentTime, nciu & chan )
|
||||
void installChannel ( const epicsTime & currentTime,
|
||||
nciu & chan, unsigned minRetryNo )
|
||||
{
|
||||
bool firstChannel = false;
|
||||
|
||||
epicsGuard < udpMutex> guard ( this->mutex );
|
||||
epicsGuard < udpMutex > guard ( this->mutex );
|
||||
// add it to the front of the list so that
|
||||
// a search request is sent immediately, and
|
||||
// so that the new channel's retry count is
|
||||
@@ -1058,7 +1059,8 @@ void udpiiu::installChannel ( const epicsTime & currentTime, nciu & chan )
|
||||
if ( this->channelList.count() == 1 ) {
|
||||
firstChannel = true;
|
||||
}
|
||||
this->pSearchTmr->newChannelNotify ( guard, currentTime, firstChannel );
|
||||
this->pSearchTmr->newChannelNotify ( guard, currentTime,
|
||||
firstChannel, minRetryNo );
|
||||
}
|
||||
|
||||
int udpiiu::printf ( const char *pformat, ... )
|
||||
|
||||
@@ -84,7 +84,8 @@ class udpiiu : public netiiu {
|
||||
public:
|
||||
udpiiu ( class epicsTimerQueueActive &, callbackMutex &, class cac & );
|
||||
virtual ~udpiiu ();
|
||||
void installChannel ( const epicsTime & currentTime, nciu & );
|
||||
void installNewChannel ( const epicsTime & currentTime, nciu & );
|
||||
void installDisconnectedChannel ( const epicsTime & currentTime, nciu & );
|
||||
void repeaterRegistrationMessage ( unsigned attemptNumber );
|
||||
bool searchMsg ( epicsGuard < udpMutex > &, unsigned & retryNoForThisChannel );
|
||||
void datagramFlush ( epicsGuard < udpMutex > &, const epicsTime & currentTime );
|
||||
@@ -183,6 +184,7 @@ private:
|
||||
void requestRecvProcessPostponedFlush ();
|
||||
osiSockAddr getNetworkAddress () const;
|
||||
double receiveWatchdogDelay () const;
|
||||
void installChannel ( const epicsTime & currentTime, nciu &, unsigned minRetryNo );
|
||||
|
||||
udpiiu ( const udpiiu & );
|
||||
udpiiu & operator = ( const udpiiu & );
|
||||
@@ -190,9 +192,11 @@ private:
|
||||
|
||||
// This impacts the exponential backoff delay between search messages.
|
||||
// This delay is two to the power of the minimum channel retry count
|
||||
// times the estimated round trip time. So this results in about a
|
||||
// one second delay.
|
||||
static const unsigned beaconAnomalyRetrySetpoint = 10u;
|
||||
// times the estimated round trip time or the OS's delay quantum
|
||||
// whichever is greater. So this results in about a one second delay.
|
||||
//
|
||||
static const unsigned beaconAnomalyRetrySetpoint = 6u;
|
||||
static const unsigned disconnectRetrySetpoint = 6u;
|
||||
|
||||
inline void udpMutex::lock ()
|
||||
{
|
||||
@@ -227,5 +231,15 @@ inline double udpiiu::roundTripDelayEstimate (
|
||||
return this->rtteMean;
|
||||
}
|
||||
|
||||
inline void udpiiu::installNewChannel ( const epicsTime & currentTime, nciu & chan )
|
||||
{
|
||||
this->installChannel ( currentTime, chan, 0 );
|
||||
}
|
||||
|
||||
inline void udpiiu::installDisconnectedChannel ( const epicsTime & currentTime, nciu & chan )
|
||||
{
|
||||
this->installChannel ( currentTime, chan, disconnectRetrySetpoint );
|
||||
}
|
||||
|
||||
#endif // udpiiuh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user