aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-18 11:38:41 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-18 11:40:22 -0400
commit23fdf0b30fd9fdfe1f82e5aa1b8a196c3ca68575 (patch)
tree55ec698d0f84dd0d5d4ab456a1a2a2ccf6586df1 /src/or/dirserv.c
parenta4c5287e1b8fbb132cefc834ee717f6c21953e0d (diff)
downloadtor-23fdf0b30fd9fdfe1f82e5aa1b8a196c3ca68575.tar
tor-23fdf0b30fd9fdfe1f82e5aa1b8a196c3ca68575.tar.gz
Allow some skew in checking when a router said it was hibernating
This solves the problem Roger noted as: What if the router has a clock that's 5 minutes off, so it publishes a descriptor for 5 minutes in the future, and we test it three minutes in. In this edge case, we will continue to advertise it as Running for the full 45 minute period.
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index dd9026758..80831b5be 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -923,6 +923,11 @@ running_long_enough_to_decide_unreachable(void)
* the directory. */
#define REACHABLE_TIMEOUT (45*60)
+/** If we tested a router and found it reachable _at least this long_ after it
+ * declared itself hibernating, it is probably done hibernating and we just
+ * missed a descriptor from it. */
+#define ALLOW_REACHABILITY_PUBLICATION_SKEW (60*60)
+
/** Treat a router as alive if
* - It's me, and I'm not hibernating.
* or - We've found it reachable recently. */
@@ -939,7 +944,8 @@ dirserv_set_router_is_running(routerinfo_t *router, time_t now)
/* We always know if we are down ourselves. */
answer = ! we_are_hibernating();
} else if (router->is_hibernating &&
- router->cache_info.published_on > router->last_reachable) {
+ (router->cache_info.published_on +
+ ALLOW_REACHABILITY_PUBLICATION_SKEW) > router->last_reachable) {
/* A hibernating router is down unless we (somehow) had contact with it
* since it declared itself to be hibernating. */
answer = 0;