--- /dev/null
+ o Minor bugfixes:
+ - Don't try to open non-control listeners when DisableNetwork is set.
+ Previousy, we'd open all listeners, then immediately close them.
+ Fixes bug 5604; bugfix on 0.2.3.9-alpha.
* 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) < 0) {
+ if (retry_all_listeners(replaced_listeners, new_listeners,
+ options->DisableNetwork) < 0) {
*msg = tor_strdup("Failed to bind one of the listener ports.");
goto rollback;
}
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. */
*/
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();
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
const connection_t *conn);
int retry_all_listeners(smartlist_t *replaced_conns,
- smartlist_t *new_conns);
+ smartlist_t *new_conns,
+ int close_all_noncontrol);
void connection_mark_all_noncontrol_listeners(void);
void connection_mark_all_noncontrol_connections(void);
/** 3d. And every 60 seconds, we relaunch listeners if any died. */
if (!net_is_disabled() && time_to_check_listeners < now) {
- retry_all_listeners(NULL, NULL);
+ retry_all_listeners(NULL, NULL, 0);
time_to_check_listeners = now+60;
}