diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-30 17:00:36 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-05-30 17:00:36 -0400 |
commit | fe68a80f8f1e687d9e3dcdf6dfc5d0a8f3524335 (patch) | |
tree | 484e4bc7888e1832a62e99815d1fee3a0d9ddf54 /src/or/connection.c | |
parent | 37f42c2f5898dedfb043a760b30081a0c39f1cd1 (diff) | |
parent | d7e4777791bbaa93f82b98c2529450794b9e8a3f (diff) | |
download | tor-fe68a80f8f1e687d9e3dcdf6dfc5d0a8f3524335.tar.gz tor-fe68a80f8f1e687d9e3dcdf6dfc5d0a8f3524335.zip |
Merge branch 'bug5604'
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 0c970cc3b4..eb8b840eb7 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1812,17 +1812,28 @@ connection_read_proxy_handshake(connection_t *conn) * entry in <b>ports</b>. Add to <b>new_conns</b> new every connection we * launch. * + * If <b>control_listeners_only</b> is true, then we only open control + * listeners, and we do not remove any noncontrol listeners from old_conns. + * * Return 0 on success, -1 on failure. **/ static int retry_listener_ports(smartlist_t *old_conns, const smartlist_t *ports, - smartlist_t *new_conns) + smartlist_t *new_conns, + int control_listeners_only) { smartlist_t *launch = smartlist_new(); int r = 0; - smartlist_add_all(launch, ports); + if (control_listeners_only) { + 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. */ @@ -1922,10 +1933,13 @@ retry_listener_ports(smartlist_t *old_conns, * * Add all old conns that should be closed to <b>replaced_conns</b>. * Add all new connections to <b>new_conns</b>. + * + * If <b>close_all_noncontrol</b> is true, then we only open control + * listeners, and we close all other listeners. */ 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(); @@ -1940,7 +1954,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 |