options_act_reversible(const or_options_t *old_options, char **msg)
{
smartlist_t *new_listeners = smartlist_new();
- smartlist_t *replaced_listeners = smartlist_new();
or_options_t *options = get_options_mutable();
int running_tor = options->command == CMD_RUN_TOR;
int set_conn_limit = 0;
* shutting down. If networking is disabled, this will close all but the
* control listeners, but disable those. */
if (!we_are_hibernating()) {
- if (retry_all_listeners(replaced_listeners, new_listeners,
- options->DisableNetwork) < 0) {
+ if (retry_all_listeners(new_listeners, options->DisableNetwork) < 0) {
*msg = tor_strdup("Failed to bind one of the listener ports.");
goto rollback;
}
"Overwrite the log afterwards.", badness);
}
- SMARTLIST_FOREACH(replaced_listeners, connection_t *, conn,
- {
- int marked = conn->marked_for_close;
- log_notice(LD_NET, "Closing old %s on %s:%d",
- conn_type_to_string(conn->type), conn->address, conn->port);
- connection_close_immediate(conn);
- if (!marked) {
- connection_mark_for_close(conn);
- }
- });
-
if (set_conn_limit) {
/*
* If we adjusted the conn limit, recompute the OOS threshold too
done:
smartlist_free(new_listeners);
- smartlist_free(replaced_listeners);
return r;
}
* listeners who are not already open, and only close listeners we no longer
* want.
*
- * 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, int close_all_noncontrol)
+retry_all_listeners(smartlist_t *new_conns, int close_all_noncontrol)
{
smartlist_t *listeners = smartlist_new();
smartlist_t *replacements = smartlist_new();
if (skip)
continue;
- // XXX: replaced_conns
connection_close_immediate(r->old_conn);
connection_mark_for_close(r->old_conn);
SMARTLIST_FOREACH_BEGIN(listeners, connection_t *, conn) {
log_notice(LD_NET, "Closing no-longer-configured %s on %s:%d",
conn_type_to_string(conn->type), conn->address, conn->port);
- if (replaced_conns) {
- smartlist_add(replaced_conns, conn);
- } else {
- connection_close_immediate(conn);
- connection_mark_for_close(conn);
- }
+ connection_close_immediate(conn);
+ connection_mark_for_close(conn);
} SMARTLIST_FOREACH_END(conn);
smartlist_free(listeners);
int get_proxy_addrport(tor_addr_t *addr, uint16_t *port, int *proxy_type,
const connection_t *conn);
-int retry_all_listeners(smartlist_t *replaced_conns,
- smartlist_t *new_conns,
+int retry_all_listeners(smartlist_t *new_conns,
int close_all_noncontrol);
void connection_mark_all_noncontrol_listeners(void);
(void)now;
(void)options;
if (!net_is_disabled()) {
- retry_all_listeners(NULL, NULL, 0);
+ retry_all_listeners(NULL, 0);
return 60;
}
return PERIODIC_EVENT_NO_UPDATE;