diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-08-08 09:40:04 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-08-08 09:40:04 -0400 |
commit | 7e32db478b6619c8e25ad117a59361b1f5cdfa48 (patch) | |
tree | 5afc461a92dddfa78bac1e933e6a65e5a320f95e /src | |
parent | 79569d86b36ae1a89b5656bf8356247574b32e95 (diff) | |
parent | a4400a77a5db2fc60db258857a23a11ec741e426 (diff) | |
download | tor-7e32db478b6619c8e25ad117a59361b1f5cdfa48.tar.gz tor-7e32db478b6619c8e25ad117a59361b1f5cdfa48.zip |
Merge branch 'ticket31343_035' into ticket31343_040
Diffstat (limited to 'src')
-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 d1220f553a..da3b673b69 100644 --- a/src/feature/nodelist/routerlist.c +++ b/src/feature/nodelist/routerlist.c @@ -2856,7 +2856,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. */ @@ -2920,7 +2920,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) |