From 48a374c82c89b69a71d1922c4396265394e9045f Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 6 Sep 2016 14:05:58 -0700 Subject: (1) fix crazy bug introduced in doRENDEZVOUS(), (2) reclaim Paths after paths[] condense, (3) fix an edge case around symmetric NAT and external IP change detection. --- node/Peer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'node/Peer.cpp') diff --git a/node/Peer.cpp b/node/Peer.cpp index ab287d05..c56dbca9 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -339,7 +339,9 @@ bool Peer::resetWithinScope(InetAddress::IpScope scope,uint64_t now) ++x; } _numPaths = y; - return (y < np); + while (y < ZT_MAX_PEER_NETWORK_PATHS) + _paths[y++].path.zero(); // let go of unused SmartPtr<>'s + return (_numPaths < np); } void Peer::getBestActiveAddresses(uint64_t now,InetAddress &v4,InetAddress &v6) const @@ -390,6 +392,8 @@ void Peer::clean(uint64_t now) ++x; } _numPaths = y; + while (y < ZT_MAX_PEER_NETWORK_PATHS) + _paths[y++].path.zero(); // let go of unused SmartPtr<>'s } bool Peer::_pushDirectPaths(const SharedPtr &path,uint64_t now) -- cgit v1.2.3