diff options
author | Peter Palfrader <peter@palfrader.org> | 2007-06-04 16:54:42 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2007-06-04 16:54:42 +0000 |
commit | 502879e0b48b189186b2b36469afeee13a0c32db (patch) | |
tree | caa789dd1a17d2d69e7cd3bb9bf749c0314aa96e | |
parent | 6faa9e26414abde4832ec88c347435565c751e0b (diff) | |
download | tor-502879e0b48b189186b2b36469afeee13a0c32db.tar tor-502879e0b48b189186b2b36469afeee13a0c32db.tar.gz |
Remove force flag from retry_all_listeners() and retry_listeners(). It always was 0.
svn:r10486
-rw-r--r-- | src/or/config.c | 2 | ||||
-rw-r--r-- | src/or/connection.c | 40 | ||||
-rw-r--r-- | src/or/main.c | 2 | ||||
-rw-r--r-- | src/or/or.h | 2 |
4 files changed, 17 insertions, 29 deletions
diff --git a/src/or/config.c b/src/or/config.c index 19265965f..3b32786e3 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -830,7 +830,7 @@ options_act_reversible(or_options_t *old_options, char **msg) /* Launch the listeners. (We do this before we setuid, so we can bind to * ports under 1024.) */ - if (retry_all_listeners(0, replaced_listeners, new_listeners) < 0) { + if (retry_all_listeners(replaced_listeners, new_listeners) < 0) { *msg = tor_strdup("Failed to bind one of the listener ports."); goto rollback; } diff --git a/src/or/connection.c b/src/or/connection.c index 47f8c8bbe..0daa914b7 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -995,17 +995,16 @@ connection_connect(connection_t *conn, const char *address, * connection binding to each one. Otherwise, create a single * connection binding to the address <b>default_addr</b>.) * - * If <b>force</b> is true, close and re-open all listener connections. - * Otherwise, only relaunch the listeners of this type if the number of - * existing connections is not as configured (e.g., because one died), - * or if the existing connections do not match those configured. + * Only relaunch the listeners of this type if the number of existing + * connections is not as configured (e.g., because one died), or if the + * existing connections do not match those configured. * * Add all old conns that should be closed to <b>replaced_conns</b>. * Add all new connections to <b>new_conns</b>. */ static int retry_listeners(int type, config_line_t *cfg, - int port_option, const char *default_addr, int force, + int port_option, const char *default_addr, smartlist_t *replaced_conns, smartlist_t *new_conns, int never_open_conns) @@ -1039,15 +1038,6 @@ retry_listeners(int type, config_line_t *cfg, { if (conn->type != type || conn->marked_for_close) continue; - if (force) { - /* It's a listener, and we're relaunching all listeners of this - * type. Close this one. */ - log_notice(LD_NET, "Force-closing listener %s on %s:%d", - conn_type_to_string(type), conn->address, conn->port); - connection_close_immediate(conn); - connection_mark_for_close(conn); - continue; - } /* Okay, so this is a listener. Is it configured? */ line = NULL; SMARTLIST_FOREACH(launch, config_line_t *, wanted, @@ -1110,47 +1100,45 @@ retry_listeners(int type, config_line_t *cfg, return r; } -/** (Re)launch listeners for each port you should have open. If - * <b>force</b> is true, close and relaunch all listeners. If <b>force</b> - * is false, then only relaunch listeners when we have the wrong number of - * connections for a given type. +/** (Re)launch listeners for each port you should have open. Only relaunch + * listeners when we have the wrong number of connections for a given type. * * Add all old conns that should be closed to <b>replaced_conns</b>. * Add all new connections to <b>new_conns</b>. */ int -retry_all_listeners(int force, smartlist_t *replaced_conns, +retry_all_listeners(smartlist_t *replaced_conns, smartlist_t *new_conns) { or_options_t *options = get_options(); if (retry_listeners(CONN_TYPE_OR_LISTENER, options->ORListenAddress, - options->ORPort, "0.0.0.0", force, + options->ORPort, "0.0.0.0", replaced_conns, new_conns, options->ClientOnly)<0) return -1; if (retry_listeners(CONN_TYPE_DIR_LISTENER, options->DirListenAddress, - options->DirPort, "0.0.0.0", force, + options->DirPort, "0.0.0.0", replaced_conns, new_conns, 0)<0) return -1; if (retry_listeners(CONN_TYPE_AP_LISTENER, options->SocksListenAddress, - options->SocksPort, "127.0.0.1", force, + options->SocksPort, "127.0.0.1", replaced_conns, new_conns, 0)<0) return -1; if (retry_listeners(CONN_TYPE_AP_TRANS_LISTENER, options->TransListenAddress, - options->TransPort, "127.0.0.1", force, + options->TransPort, "127.0.0.1", replaced_conns, new_conns, 0)<0) return -1; if (retry_listeners(CONN_TYPE_AP_NATD_LISTENER, options->NatdListenAddress, - options->NatdPort, "127.0.0.1", force, + options->NatdPort, "127.0.0.1", replaced_conns, new_conns, 0)<0) return -1; if (retry_listeners(CONN_TYPE_AP_DNS_LISTENER, options->DNSListenAddress, - options->DNSPort, "127.0.0.1", force, + options->DNSPort, "127.0.0.1", replaced_conns, new_conns, 0)<0) return -1; if (retry_listeners(CONN_TYPE_CONTROL_LISTENER, options->ControlListenAddress, - options->ControlPort, "127.0.0.1", force, + options->ControlPort, "127.0.0.1", replaced_conns, new_conns, 0)<0) return -1; diff --git a/src/or/main.c b/src/or/main.c index b9fd74736..9f88f66c4 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1012,7 +1012,7 @@ run_scheduled_events(time_t now) /** 3d. And every 60 seconds, we relaunch listeners if any died. */ if (!we_are_hibernating() && time_to_check_listeners < now) { /* 0 means "only launch the ones that died." */ - retry_all_listeners(0, NULL, NULL); + retry_all_listeners(NULL, NULL); time_to_check_listeners = now+60; } diff --git a/src/or/or.h b/src/or/or.h index 8001f2849..7afa3eccc 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2341,7 +2341,7 @@ void connection_expire_held_open(void); int connection_connect(connection_t *conn, const char *address, uint32_t addr, uint16_t port); -int retry_all_listeners(int force, smartlist_t *replaced_conns, +int retry_all_listeners(smartlist_t *replaced_conns, smartlist_t *new_conns); int connection_bucket_write_limit(connection_t *conn); |