summaryrefslogtreecommitdiff
path: root/node/Peer.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-30 14:23:52 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-30 14:23:52 -0800
commit490e86dde3532b36617548bdf9d952caa43dffa3 (patch)
treea99d2a2d3b7179054f98b27db47bb1108e55b7ce /node/Peer.cpp
parent6e076e77d82ef78d407fab66b235fe936c02d13a (diff)
downloadinfinitytier-490e86dde3532b36617548bdf9d952caa43dffa3.tar.gz
infinitytier-490e86dde3532b36617548bdf9d952caa43dffa3.zip
Bunch of fixes to startup, pinging, and choice of route. Also some TRACE updates.
Diffstat (limited to 'node/Peer.cpp')
-rw-r--r--node/Peer.cpp14
1 files changed, 8 insertions, 6 deletions
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<Peer>(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<Peer>(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<Peer>(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<Peer>(this),_ipv6p.localPort,_ipv6p.addr)) {
_ipv6p.lastSend = now;
sent = true;