summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-21 14:34:36 -0400
committerNick Mathewson <nickm@torproject.org>2017-11-09 09:19:42 -0500
commit0c6eabf08898e0c9f2faa397f2c2bb5fb80b78b9 (patch)
tree0115299b2405fd12b0f76ab124f8433d91829521 /src/or/connection.c
parent6045bdd4a0542ef11dc46d98495686172015a961 (diff)
downloadtor-0c6eabf08898e0c9f2faa397f2c2bb5fb80b78b9.tar.gz
tor-0c6eabf08898e0c9f2faa397f2c2bb5fb80b78b9.zip
Audit all of the "is the network turned off" checks.
DisableNetwork is a subset of net_is_disabled(), which is (now) a subset of should_delay_dir_fetches(). Some of these changes are redundant with others higher or lower in the call stack. The ones that I think are behavior-relevant are listed in the changes file. I've also added comments in a few places where the behavior is subtle. Fixes bug 12062; bugfix on various versions.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 632a833652..66eccf7cee 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1746,7 +1746,11 @@ connection_connect_sockaddr,(connection_t *conn,
if (get_options()->DisableNetwork) {
/* We should never even try to connect anyplace if DisableNetwork is set.
- * Warn if we do, and refuse to make the connection. */
+ * Warn if we do, and refuse to make the connection.
+ *
+ * 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) */
static ratelim_t disablenet_violated = RATELIM_INIT(30*60);
*socket_error = SOCK_ERRNO(ENETUNREACH);
log_fn_ratelim(&disablenet_violated, LOG_WARN, LD_BUG,