diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-08-08 11:23:59 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-08-08 11:23:59 -0400 |
commit | 0bc5b7ae95a2cc11b380ba09aab0ed1f4219f90b (patch) | |
tree | 996f3103dab15e785a1fc99826099053717b21c7 /src/feature/nodelist | |
parent | 40d7f1e3a67c7777f44e50e009c313baf686e6b2 (diff) | |
parent | 7e32db478b6619c8e25ad117a59361b1f5cdfa48 (diff) | |
download | tor-0bc5b7ae95a2cc11b380ba09aab0ed1f4219f90b.tar.gz tor-0bc5b7ae95a2cc11b380ba09aab0ed1f4219f90b.zip |
Merge branch 'ticket31343_040' into maint-0.4.1
Diffstat (limited to 'src/feature/nodelist')
-rw-r--r-- | src/feature/nodelist/routerlist.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/feature/nodelist/routerlist.c b/src/feature/nodelist/routerlist.c index 9c2debea2f..c56b714cb0 100644 --- a/src/feature/nodelist/routerlist.c +++ b/src/feature/nodelist/routerlist.c @@ -2860,7 +2860,7 @@ int router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2) { time_t r1pub, r2pub; - long time_difference; + time_t time_difference; tor_assert(r1 && r2); /* r1 should be the one that was published first. */ @@ -2924,7 +2924,9 @@ router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2) * give or take some slop? */ r1pub = r1->cache_info.published_on; r2pub = r2->cache_info.published_on; - time_difference = labs(r2->uptime - (r1->uptime + (r2pub - r1pub))); + time_difference = r2->uptime - (r1->uptime + (r2pub - r1pub)); + if (time_difference < 0) + time_difference = - time_difference; if (time_difference > ROUTER_ALLOW_UPTIME_DRIFT && time_difference > r1->uptime * .05 && time_difference > r2->uptime * .05) |