diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-07 15:15:52 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-07 15:15:52 -0700 |
| commit | 1908aa55f51d63bceb7ed5d4211a4274d732de63 (patch) | |
| tree | 105983c4e812f1a082e0e36da57842da43148648 /node/Peer.cpp | |
| parent | 1c08f5e8578fa05975e9885212b6bd4583b397dc (diff) | |
| download | infinitytier-1908aa55f51d63bceb7ed5d4211a4274d732de63.tar.gz infinitytier-1908aa55f51d63bceb7ed5d4211a4274d732de63.zip | |
Refactor MULTICAST_LIKE pushing to eliminate redundant and unnecessary pushes and simplify code.
Diffstat (limited to 'node/Peer.cpp')
| -rw-r--r-- | node/Peer.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp index 3d3ca247..43daeb13 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -45,7 +45,6 @@ Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Ident _lastReceive(0), _lastUnicastFrame(0), _lastMulticastFrame(0), - _lastAnnouncedTo(0), _lastDirectPathPushSent(0), _lastDirectPathPushReceive(0), RR(renv), @@ -66,12 +65,13 @@ Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Ident void Peer::received( const SharedPtr<Path> &path, - unsigned int hops, - uint64_t packetId, - Packet::Verb verb, - uint64_t inRePacketId, - Packet::Verb inReVerb, - const bool trustEstablished) + const unsigned int hops, + const uint64_t packetId, + const Packet::Verb verb, + const uint64_t inRePacketId, + const Packet::Verb inReVerb, + const bool trustEstablished, + const SharedPtr<Network> &network) { const uint64_t now = RR->node->now(); @@ -197,13 +197,6 @@ void Peer::received( // Send PUSH_DIRECT_PATHS if hops>0 (relayed) and we have a trust relationship (common network membership) _pushDirectPaths(path,now); } - - if ((now - _lastAnnouncedTo) >= ((ZT_MULTICAST_LIKE_EXPIRE / 2) - 1000)) { - _lastAnnouncedTo = now; - const std::vector< SharedPtr<Network> > networks(RR->node->allNetworks()); - for(std::vector< SharedPtr<Network> >::const_iterator n(networks.begin());n!=networks.end();++n) - (*n)->tryAnnounceMulticastGroupsTo(SharedPtr<Peer>(this)); - } } bool Peer::hasActivePathTo(uint64_t now,const InetAddress &addr) const |
