diff options
| author | Grant Limberg <grant.limberg@zerotier.com> | 2016-11-30 10:21:19 -0800 |
|---|---|---|
| committer | Grant Limberg <grant.limberg@zerotier.com> | 2016-11-30 10:21:19 -0800 |
| commit | 32478845b2df919d7546a889e49d276ea416a1f3 (patch) | |
| tree | 57e4d52862e90222a540a733935d237a03fdbe52 /node/Peer.cpp | |
| parent | a39f6e9b4c3ccba677f58f3c0aafe9e6186c3031 (diff) | |
| parent | 44f0e3097ee081b50628821b6db2b740489a89c6 (diff) | |
| download | infinitytier-32478845b2df919d7546a889e49d276ea416a1f3.tar.gz infinitytier-32478845b2df919d7546a889e49d276ea416a1f3.zip | |
Merge branch 'dev' into systemtray
Diffstat (limited to 'node/Peer.cpp')
| -rw-r--r-- | node/Peer.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp index 94fb5298..2ef139e1 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -43,6 +43,7 @@ static uint32_t _natKeepaliveBuf = 0; Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Identity &peerIdentity) : _lastReceive(0), _lastNontrivialReceive(0), + _lastTriedMemorizedPath(0), _lastDirectPathPushSent(0), _lastDirectPathPushReceive(0), _lastCredentialRequestSent(0), @@ -160,7 +161,7 @@ void Peer::received( } } - if ( (!pathIsConfirmed) && (RR->node->shouldUsePathForZeroTierTraffic(path->localAddress(),path->address())) ) { + if ( (!pathIsConfirmed) && (RR->node->shouldUsePathForZeroTierTraffic(_id.address(),path->localAddress(),path->address())) ) { if (verb == Packet::VERB_OK) { Mutex::Lock _l(_paths_m); @@ -373,6 +374,16 @@ void Peer::attemptToContactAt(const InetAddress &localAddr,const InetAddress &at } } +void Peer::tryMemorizedPath(uint64_t now) +{ + if ((now - _lastTriedMemorizedPath) >= ZT_TRY_MEMORIZED_PATH_INTERVAL) { + _lastTriedMemorizedPath = now; + InetAddress mp; + if (RR->node->externalPathLookup(_id.address(),-1,mp)) + attemptToContactAt(InetAddress(),mp,now); + } +} + bool Peer::doPingAndKeepalive(uint64_t now,int inetAddressFamily) { Mutex::Lock _l(_paths_m); |
