From 490e86dde3532b36617548bdf9d952caa43dffa3 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 30 Jan 2014 14:23:52 -0800 Subject: Bunch of fixes to startup, pinging, and choice of route. Also some TRACE updates. --- node/Peer.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'node/Peer.cpp') diff --git a/node/Peer.cpp b/node/Peer.cpp index 5a59031d..512918de 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -77,12 +77,6 @@ void Peer::onReceive( uint64_t now) { if (!hops) { // direct packet - // Announce multicast LIKEs to peers to whom we have a direct link - if ((now - _lastAnnouncedTo) >= ((ZT_MULTICAST_LIKE_EXPIRE / 2) - 1000)) { - _lastAnnouncedTo = now; - _r->sw->announceMulticastGroups(SharedPtr(this)); - } - // Update last receive info for our direct path WanPath *const wp = (remoteAddr.isV4() ? &_ipv4p : &_ipv6p); wp->lastReceive = now; @@ -100,6 +94,12 @@ void Peer::onReceive( } } } + + // Announce multicast LIKEs to peers to whom we have a direct link + if ((now - _lastAnnouncedTo) >= ((ZT_MULTICAST_LIKE_EXPIRE / 2) - 1000)) { + _lastAnnouncedTo = now; + _r->sw->announceMulticastGroups(SharedPtr(this)); + } } if (verb == Packet::VERB_FRAME) { @@ -150,12 +150,14 @@ bool Peer::sendPing(const RuntimeEnvironment *_r,uint64_t now) { bool sent = false; if (_ipv4p.addr) { + TRACE("PING %s(%s)",_id.address().toString().c_str(),_ipv4p.addr.toString().c_str()); if (_r->sw->sendHELLO(SharedPtr(this),_ipv4p.localPort,_ipv4p.addr)) { _ipv4p.lastSend = now; sent = true; } } if (_ipv6p.addr) { + TRACE("PING %s(%s)",_id.address().toString().c_str(),_ipv6p.addr.toString().c_str()); if (_r->sw->sendHELLO(SharedPtr(this),_ipv6p.localPort,_ipv6p.addr)) { _ipv6p.lastSend = now; sent = true; -- cgit v1.2.3