diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-01 11:11:52 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-01 11:11:52 -0700 |
commit | a3db7d0728c1bc5181b8a70e8c379632125ee376 (patch) | |
tree | ac18257023caca1e605271319e1f0063058adf41 /node/Topology.cpp | |
parent | 11ff96ba1ddc07c3414590aa31a35e6353176213 (diff) | |
download | infinitytier-a3db7d0728c1bc5181b8a70e8c379632125ee376.tar.gz infinitytier-a3db7d0728c1bc5181b8a70e8c379632125ee376.zip |
Refactor: move network COMs out of Network and into Peer in prep for tightening up multicast lookup and other things.
Diffstat (limited to 'node/Topology.cpp')
-rw-r--r-- | node/Topology.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/node/Topology.cpp b/node/Topology.cpp index e931df1e..b2b4ebbd 100644 --- a/node/Topology.cpp +++ b/node/Topology.cpp @@ -62,7 +62,7 @@ void Topology::setRootServers(const std::map< Identity,std::vector<InetAddress> if (!p) p = SharedPtr<Peer>(new Peer(RR->identity,i->first)); for(std::vector<InetAddress>::const_iterator j(i->second.begin());j!=i->second.end();++j) - p->addPath(RemotePath(InetAddress(),*j,true)); + p->addPath(RemotePath(InetAddress(),*j,true),now); p->use(now); _rootPeers.push_back(p); } @@ -252,9 +252,12 @@ void Topology::clean(uint64_t now) Hashtable< Address,SharedPtr<Peer> >::Iterator i(_activePeers); Address *a = (Address *)0; SharedPtr<Peer> *p = (SharedPtr<Peer> *)0; - while (i.next(a,p)) + while (i.next(a,p)) { if (((now - (*p)->lastUsed()) >= ZT_PEER_IN_MEMORY_EXPIRATION)&&(std::find(_rootAddresses.begin(),_rootAddresses.end(),*a) == _rootAddresses.end())) { _activePeers.erase(*a); + } else { + (*p)->clean(RR,now); + } } } |