diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-11-29 17:52:23 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-11-29 17:52:23 -0500 |
commit | 83f66db79ec6469beea0fb410be6536acb90ffd0 (patch) | |
tree | 8fedd246085e64d91e9a08a9bddb624159aeeffe /src/or/router.c | |
parent | 9e25422eed03ad5fe8f54653fbc74668561f43a1 (diff) | |
parent | 9e8f3ee8e4d5ad5ce98aeb37b2b8c724a1936355 (diff) | |
download | tor-83f66db79ec6469beea0fb410be6536acb90ffd0.tar.gz tor-83f66db79ec6469beea0fb410be6536acb90ffd0.zip |
Merge branch 'disable_network'
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/or/router.c b/src/or/router.c index b6b96a5fff..d0292aa66a 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -780,7 +780,7 @@ check_whether_dirport_reachable(void) const or_options_t *options = get_options(); return !options->DirPort || options->AssumeReachable || - we_are_hibernating() || + net_is_disabled() || can_reach_dir_port; } @@ -806,7 +806,7 @@ decide_to_advertise_dirport(const or_options_t *options, uint16_t dir_port) return 0; if (authdir_mode(options)) /* always publish */ return dir_port; - if (we_are_hibernating()) + if (net_is_disabled()) return 0; if (!check_whether_dirport_reachable()) return 0; @@ -974,6 +974,14 @@ router_perform_bandwidth_test(int num_circs, time_t now) } } +/** Return true iff our network is in some sense disabled: either we're + * hibernating, entering hibernation, or */ +int +net_is_disabled(void) +{ + return get_options()->DisableNetwork || we_are_hibernating(); +} + /** Return true iff we believe ourselves to be an authoritative * directory server. */ |