diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-04-18 23:32:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-04-18 23:32:02 -0400 |
commit | 074bf72a2cb9e641468b9ef92a8b16c7f0e2f00a (patch) | |
tree | b0bd0f43eefc33863b87b8eecfb7929e8a89a828 /src/or/connection.c | |
parent | e9dae1ff2e147d2b74fb1ce2836fb9c42f227af4 (diff) | |
download | tor-074bf72a2cb9e641468b9ef92a8b16c7f0e2f00a.tar.gz tor-074bf72a2cb9e641468b9ef92a8b16c7f0e2f00a.zip |
If DisableNetwork, don't even try to open non-controller listeners
Fix for 5604; bugfix on 0.2.3.9-alpha, which introduced DisableNetwork.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 1c034c655b..642ee6e957 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1812,12 +1812,20 @@ connection_read_proxy_handshake(connection_t *conn) static int retry_listener_ports(smartlist_t *old_conns, const smartlist_t *ports, - smartlist_t *new_conns) + smartlist_t *new_conns, + int close_all_noncontrol) { smartlist_t *launch = smartlist_new(); int r = 0; - smartlist_add_all(launch, ports); + if (close_all_noncontrol) { + SMARTLIST_FOREACH(ports, port_cfg_t *, p, { + if (p->type == CONN_TYPE_CONTROL_LISTENER) + smartlist_add(launch, p); + }); + } else { + smartlist_add_all(launch, ports); + } /* Iterate through old_conns, comparing it to launch: remove from both lists * each pair of elements that corresponds to the same port. */ @@ -1920,7 +1928,7 @@ retry_listener_ports(smartlist_t *old_conns, */ int retry_all_listeners(smartlist_t *replaced_conns, - smartlist_t *new_conns) + smartlist_t *new_conns, int close_all_noncontrol) { smartlist_t *listeners = smartlist_new(); const or_options_t *options = get_options(); @@ -1935,7 +1943,8 @@ retry_all_listeners(smartlist_t *replaced_conns, if (retry_listener_ports(listeners, get_configured_ports(), - new_conns) < 0) + new_conns, + close_all_noncontrol) < 0) retval = -1; /* Any members that were still in 'listeners' don't correspond to |