get rid of the separate reachability window for the hsdir flag.

svn:r12527
This commit is contained in:
Roger Dingledine 2007-11-17 12:15:32 +00:00
parent b701583ffa
commit d62ef13d0a
2 changed files with 7 additions and 9 deletions

View File

@ -1537,9 +1537,12 @@ dirserv_thinks_router_is_unreliable(time_t now,
return 0; return 0;
} }
/** Return true if <b>router</b> has an uptime of at least /** Return true iff <b>router</b> should be assigned the "HSDir" flag.
* <b>__MinUptimeHidServDirectoryV2</b> and is reachable in the last * Right now this means it advertises support for it, it has a high
* REND_HS_DIR_REACHABLE_TIMEOUT seconds, else false. * uptime, and it's currently considered Running.
*
* This function needs to be called after router->is_running has
* been set.
*/ */
static int static int
dirserv_thinks_router_is_hs_dir(routerinfo_t *router, time_t now) dirserv_thinks_router_is_hs_dir(routerinfo_t *router, time_t now)
@ -1548,8 +1551,7 @@ dirserv_thinks_router_is_hs_dir(routerinfo_t *router, time_t now)
return (router->wants_to_be_hs_dir && return (router->wants_to_be_hs_dir &&
uptime > get_options()->__MinUptimeHidServDirectoryV2 && uptime > get_options()->__MinUptimeHidServDirectoryV2 &&
((router_is_me(router) && !we_are_hibernating()) || router->is_running);
(now < router->last_reachable + REND_HS_DIR_REACHABLE_TIMEOUT)));
} }
/** Look through the routerlist, and assign the median uptime of running valid /** Look through the routerlist, and assign the median uptime of running valid

View File

@ -608,10 +608,6 @@ typedef enum {
* in the ring) for a descriptor. */ * in the ring) for a descriptor. */
#define REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS 2 #define REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS 2
/** Maximum time that an onion router may not respond unless taken
* from the list of hidden service directories. */
#define REND_HS_DIR_REACHABLE_TIMEOUT (45*60)
/** Number of consecutive replicas for a descriptor. */ /** Number of consecutive replicas for a descriptor. */
#define REND_NUMBER_OF_CONSECUTIVE_REPLICAS 3 #define REND_NUMBER_OF_CONSECUTIVE_REPLICAS 3