Keep track of basic aliveness for peers regardless if direct or indirect connectivity and use this for multicast propagation. Also consolidate adding of active bridges via the same functor as regular multicast next hops.

This commit is contained in:
Adam Ierymenko 2014-06-30 11:31:04 -07:00
parent 458f6ae7c3
commit 88bdb81791
8 changed files with 183 additions and 108 deletions

View file

@ -35,6 +35,7 @@ namespace ZeroTier {
Peer::Peer() :
_lastUsed(0),
_lastReceive(0),
_lastUnicastFrame(0),
_lastMulticastFrame(0),
_lastAnnouncedTo(0),
@ -47,6 +48,7 @@ Peer::Peer(const Identity &myIdentity,const Identity &peerIdentity)
throw(std::runtime_error) :
_id(peerIdentity),
_lastUsed(0),
_lastReceive(0),
_lastUnicastFrame(0),
_lastMulticastFrame(0),
_lastAnnouncedTo(0),
@ -73,6 +75,9 @@ void Peer::receive(
// Update system-wide last packet receive time
*((const_cast<uint64_t *>(&(_r->timeOfLastPacketReceived)))) = now;
// Global last receive time regardless of path
_lastReceive = now;
// Learn paths from direct packets (hops == 0)
if (!hops) {
{