Clean dead paths from peers.

This commit is contained in:
Adam Ierymenko 2014-03-31 11:41:14 -07:00
parent acb056e3b1
commit 8e587ae481
5 changed files with 41 additions and 1 deletions

View file

@ -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