commit 6b228726bc44911b68d9757f13ba0642bbf04d43
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Wed Jul 20 13:11:29 2011 -0400
Initialize listener connection addr fields properly
---
src/or/connection.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/or/connection.c b/src/or/connection.c
index 38859a9..d2ee1ae 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -876,6 +876,7 @@ connection_create_listener(const struct sockaddr *listensockaddr,
uint16_t usePort = 0, gotPort = 0;
int start_reading = 0;
static int global_next_session_group = SESSION_GROUP_FIRST_AUTO;
+ tor_addr_t addr;
if (get_n_open_sockets() >= get_options()->_ConnLimit-1) {
warn_too_many_conns();
@@ -883,7 +884,6 @@ connection_create_listener(const struct sockaddr *listensockaddr,
}
if (listensockaddr->sa_family == AF_INET) {
- tor_addr_t addr;
int is_tcp = (type != CONN_TYPE_AP_DNS_LISTENER);
if (is_tcp)
start_reading = 1;
@@ -951,6 +951,8 @@ connection_create_listener(const struct sockaddr *listensockaddr,
log_notice(LD_NET, "Opening %s on %s",
conn_type_to_string(type), address);
+ tor_addr_make_unspec(&addr);
+
if (unlink(address) < 0 && errno != ENOENT) {
log_warn(LD_NET, "Could not unlink %s: %s", address,
strerror(errno));
@@ -998,6 +1000,7 @@ connection_create_listener(const struct sockaddr *listensockaddr,
conn->s = s;
conn->address = tor_strdup(address);
conn->port = gotPort;
+ tor_addr_copy(&conn->addr, &addr);
if (port_cfg->isolation_flags) {
lis_conn->isolation_flags = port_cfg->isolation_flags;
@@ -1804,8 +1807,8 @@ retry_listener_ports(smartlist_t *old_conns,
if (found_port) {
/* This listener is already running; we don't need to launch it. */
-// log_debug(LD_NET, "Already have %s on %s:%d",
-// conn_type_to_string(type), conn->address, conn->port);
+ //log_debug(LD_NET, "Already have %s on %s:%d",
+ // conn_type_to_string(found_port->type), conn->address, conn->port);
smartlist_remove(launch, found_port);
/* And we can remove the connection from old_conns too. */
SMARTLIST_DEL_CURRENT(old_conns, conn);