Permalink
Browse files

Don't allow zeroing of reach when a node responds to a ping or search…

… in exactly the right time and don't allow ugly integer underflow.
  • Loading branch information...
1 parent a6191a3 commit ce3b0a15573da3576dec898eb797098527498867 Caleb James DeLisle committed Feb 8, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 dht/dhtcore/RouterModule.c
@@ -682,8 +682,10 @@ static inline void responseFromNode(struct Node* node,
{
if (node) {
uint64_t worst = tryNextNodeAfter(module);
- node->reach = (worst - millisecondsSinceRequest) * LINK_STATE_MULTIPLIER;
- NodeStore_updateReach(node, module->nodeStore);
+ if (worst > millisecondsSinceRequest) {
+ node->reach = (worst - millisecondsSinceRequest) * LINK_STATE_MULTIPLIER;
+ NodeStore_updateReach(node, module->nodeStore);
+ }
}
}

0 comments on commit ce3b0a1

Please sign in to comment.