summaryrefslogtreecommitdiff
path: root/node/Node.cpp
diff options
context:
space:
mode:
authorGrant Limberg <glimberg@gmail.com>2015-05-23 13:34:21 -0700
committerGrant Limberg <glimberg@gmail.com>2015-05-23 13:34:21 -0700
commit5c2aaad365b5f4d575d4cc40d7808db990a7f680 (patch)
tree84d50bface4ae245994dc78cb57738711f2baebc /node/Node.cpp
parent1e043a3f66c5ae7d9c1043be3244d605cbaa64fa (diff)
parentd8783b14eb465cd97950afd726e940bbe3708c8a (diff)
downloadinfinitytier-5c2aaad365b5f4d575d4cc40d7808db990a7f680.tar.gz
infinitytier-5c2aaad365b5f4d575d4cc40d7808db990a7f680.zip
Merge branch 'adamierymenko-dev' into android-jni
Diffstat (limited to 'node/Node.cpp')
-rw-r--r--node/Node.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index 6b3f1f2c..c5c9873c 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -77,7 +77,6 @@ Node::Node(
_networks(),
_networks_m(),
_now(now),
- _startTimeAfterInactivity(0),
_lastPingCheck(0),
_lastHousekeepingRun(0),
_lastBeacon(0)
@@ -217,17 +216,12 @@ ZT1_ResultCode Node::processBackgroundTasks(uint64_t now,volatile uint64_t *next
if ((now - _lastPingCheck) >= ZT_PING_CHECK_INVERVAL) {
_lastPingCheck = now;
- // This is used to compute whether we appear to be "online" or not
- if ((now - _startTimeAfterInactivity) > (ZT_PING_CHECK_INVERVAL * 3))
- _startTimeAfterInactivity = now;
-
try {
_PingPeersThatNeedPing pfunc(RR,now);
RR->topology->eachPeer<_PingPeersThatNeedPing &>(pfunc);
- const uint64_t lastActivityAgo = now - std::max(_startTimeAfterInactivity,pfunc.lastReceiveFromUpstream);
bool oldOnline = _online;
- _online = (lastActivityAgo < ZT_PEER_ACTIVITY_TIMEOUT);
+ _online = ((now - pfunc.lastReceiveFromUpstream) < ZT_PEER_ACTIVITY_TIMEOUT);
if (oldOnline != _online)
postEvent(_online ? ZT1_EVENT_ONLINE : ZT1_EVENT_OFFLINE);
} catch ( ... ) {