#include "feature/nodelist/routerinfo_st.h"
#include "core/or/socks_request_st.h"
+#if defined(__linux__) || defined(_WIN32)
+#define ENABLE_LISTENER_REBIND
+#endif
+
static connection_t *connection_listener_new(
const struct sockaddr *listensockaddr,
socklen_t listensocklen, int type,
*defer = 0;
if (port->server_cfg.no_listen) {
- *defer = 1;
+ if (defer) *defer = 1;
return NULL;
}
const or_options_t *options = get_options();
if (port->is_unix_addr && !geteuid() && (options->User) &&
strcmp(options->User, "root")) {
- *defer = 1;
+ if (defer) *defer = 1;
return NULL;
}
#endif /* !defined(_WIN32) */
smartlist_t *replacements,
int control_listeners_only)
{
+#ifndef ENABLE_LISTENER_REBIND
+ (void)replacements;
+#endif
smartlist_t *launch = smartlist_new();
int r = 0;
found_port = wanted;
break;
}
+#ifdef ENABLE_LISTENER_REBIND
const int may_need_rebind =
port_matches_exact && bool_neq(tor_addr_is_null(&wanted->addr),
tor_addr_is_null(&conn->addr));
smartlist_add(replacements, replacement);
SMARTLIST_DEL_CURRENT(launch, wanted);
+ SMARTLIST_DEL_CURRENT(old_conns, conn);
}
+#endif
}
} SMARTLIST_FOREACH_END(wanted);
close_all_noncontrol) < 0)
retval = -1;
+#ifdef ENABLE_LISTENER_REBIND
SMARTLIST_FOREACH_BEGIN(replacements, struct replacement_s *, r) {
int addr_in_use = 0;
int skip = 0;
tor_free(r);
SMARTLIST_DEL_CURRENT(replacements, r);
} SMARTLIST_FOREACH_END(r);
+#endif
/* Any members that were still in 'listeners' don't correspond to
* any configured port. Kill 'em. */