Browse Source

Math fix.

Adam Ierymenko 10 years ago
parent
commit
6de7996218
1 changed files with 1 additions and 1 deletions
  1. 1 1
      node/Node.cpp

+ 1 - 1
node/Node.cpp

@@ -232,7 +232,7 @@ ZT1_ResultCode Node::processBackgroundTasks(uint64_t now,uint64_t *nextBackgroun
 			_PingPeersThatNeedPing pfunc(RR,now);
 			_PingPeersThatNeedPing pfunc(RR,now);
 			RR->topology->eachPeer<_PingPeersThatNeedPing &>(pfunc);
 			RR->topology->eachPeer<_PingPeersThatNeedPing &>(pfunc);
 
 
-			_coreDesperation = (unsigned int)(std::max(_startTimeAfterInactivity,pfunc.lastReceiveFromSupernode) / (ZT_PING_CHECK_INVERVAL * ZT_CORE_DESPERATION_INCREMENT));
+			_coreDesperation = (unsigned int)((now - std::max(_startTimeAfterInactivity,pfunc.lastReceiveFromSupernode)) / (ZT_PING_CHECK_INVERVAL * ZT_CORE_DESPERATION_INCREMENT));
 		} catch ( ... ) {
 		} catch ( ... ) {
 			return ZT1_RESULT_FATAL_ERROR_INTERNAL;
 			return ZT1_RESULT_FATAL_ERROR_INTERNAL;
 		}
 		}