summaryrefslogtreecommitdiff
path: root/node/Topology.cpp
diff options
context:
space:
mode:
authorGrant Limberg <grant.limberg@zerotier.com>2017-10-02 15:52:57 -0700
committerGrant Limberg <grant.limberg@zerotier.com>2017-10-02 15:52:57 -0700
commitb1d60df44cb24589bc5718da932ef4bb54168fa3 (patch)
treec240b5b626f534f4a3673bedbdf6d80b59a8d475 /node/Topology.cpp
parent7cf70d111ac3bfc1bf6aa7e3ec8d9c83e35f48a1 (diff)
downloadinfinitytier-b1d60df44cb24589bc5718da932ef4bb54168fa3.tar.gz
infinitytier-b1d60df44cb24589bc5718da932ef4bb54168fa3.zip
timestamps changed from uint64_t to int64_t
There were cases in the code where time calculations and comparisons were overflowing and causing connection instability. This will keep time calculations within expected ranges.
Diffstat (limited to 'node/Topology.cpp')
-rw-r--r--node/Topology.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/node/Topology.cpp b/node/Topology.cpp
index 8a830b93..f884e9c3 100644
--- a/node/Topology.cpp
+++ b/node/Topology.cpp
@@ -133,8 +133,9 @@ SharedPtr<Peer> Topology::getPeer(void *tPtr,const Address &zta)
if (ap)
return ap;
ap = Peer::deserializeFromCache(RR->node->now(),tPtr,buf,RR);
- if (!ap)
+ if (!ap) {
_peers.erase(zta);
+ }
return SharedPtr<Peer>();
}
} catch ( ... ) {} // ignore invalid identities or other strage failures
@@ -157,7 +158,7 @@ Identity Topology::getIdentity(void *tPtr,const Address &zta)
SharedPtr<Peer> Topology::getUpstreamPeer()
{
- const uint64_t now = RR->node->now();
+ const int64_t now = RR->node->now();
unsigned int bestq = ~((unsigned int)0);
const SharedPtr<Peer> *best = (const SharedPtr<Peer> *)0;
@@ -365,7 +366,7 @@ void Topology::removeMoon(void *tPtr,const uint64_t id)
_memoizeUpstreams(tPtr);
}
-void Topology::doPeriodicTasks(void *tPtr,uint64_t now)
+void Topology::doPeriodicTasks(void *tPtr,int64_t now)
{
{
Mutex::Lock _l1(_peers_m);