diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-05-09 12:26:50 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-05-09 12:26:50 -0400 |
commit | fa7847e450ee9884eda6236b50ea0d59db3efaba (patch) | |
tree | 0819f8549bdd1e59ee002175477f7d88a45e997f /src/or/connection.c | |
parent | 7595eae52ace0d2e0110e3d0471d4a5ca0c99ce9 (diff) | |
download | tor-fa7847e450ee9884eda6236b50ea0d59db3efaba.tar.gz tor-fa7847e450ee9884eda6236b50ea0d59db3efaba.zip |
Use net_is_completely_disabled() in connection.c
This fixes the XXXX case that we had before, and also enforces the
rule that we won't open connections when we're in hard hibernation.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 9b7e15243b..ddeffd1b48 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1762,13 +1762,13 @@ connection_connect_sockaddr,(connection_t *conn, tor_assert(sa); tor_assert(socket_error); - if (get_options()->DisableNetwork) { // XXXX change this -NM. - /* We should never even try to connect anyplace if DisableNetwork is set. - * Warn if we do, and refuse to make the connection. + if (net_is_completely_disabled()) { + /* We should never even try to connect anyplace if the network is + * completely shut off. * - * We only check DisableNetwork here, not we_are_hibernating(), since - * we'll still try to fulfill client requests sometimes in the latter case - * (if it is soft hibernation) */ + * (We don't check net_is_disabled() here, since we still sometimes + * want to open connections when we're in soft hibernation.) + */ static ratelim_t disablenet_violated = RATELIM_INIT(30*60); *socket_error = SOCK_ERRNO(ENETUNREACH); log_fn_ratelim(&disablenet_violated, LOG_WARN, LD_BUG, |