Such ping logic. So edge case.
This commit is contained in:
parent
b1088a6bd7
commit
c96d3ebf8c
5 changed files with 82 additions and 27 deletions
|
@ -226,6 +226,26 @@ public:
|
|||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param _r Runtime environment
|
||||
* @param now Current time
|
||||
* @return True if the last ping is unanswered
|
||||
*/
|
||||
inline bool pingUnanswered(const RuntimeEnvironment *_r,uint64_t now)
|
||||
throw()
|
||||
{
|
||||
uint64_t lp = 0;
|
||||
uint64_t lr = 0;
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
for(std::vector<Path>::const_iterator p(_paths.begin());p!=_paths.end();++p) {
|
||||
lp = std::max(p->lastPing(),lp);
|
||||
lr = std::max(p->lastReceived(),lr);
|
||||
}
|
||||
}
|
||||
return ( (lp > _r->timeOfLastResynchronize) && ((lr < lp)&&((lp - lr) >= ZT_PING_UNANSWERED_AFTER)) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Time of most recent unicast frame received
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue