Clean dead paths from peers.
This commit is contained in:
parent
acb056e3b1
commit
8e587ae481
5 changed files with 41 additions and 1 deletions
|
@ -187,4 +187,16 @@ bool Peer::sendPing(const RuntimeEnvironment *_r,uint64_t now,bool firstSinceRes
|
|||
return sent;
|
||||
}
|
||||
|
||||
void Peer::clean(uint64_t now)
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
unsigned long i = 0,o = 0,l = _paths.size();
|
||||
while (i != l) {
|
||||
if (_paths[i].active(now))
|
||||
_paths[o++] = _paths[i];
|
||||
++i;
|
||||
}
|
||||
_paths.resize(o);
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue