summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-07-20 13:11:29 -0400
committerNick Mathewson <nickm@torproject.org>2011-07-20 13:11:29 -0400
commit6b228726bc44911b68d9757f13ba0642bbf04d43 (patch)
tree6a41ab3d8ef9aad65302ed56f46df854f2e70d19 /src
parentda83da91993f0b939ed80c2f8353b0db50589f8e (diff)
downloadtor-6b228726bc44911b68d9757f13ba0642bbf04d43.tar.gz
tor-6b228726bc44911b68d9757f13ba0642bbf04d43.zip
Initialize listener connection addr fields properly
Diffstat (limited to 'src')
-rw-r--r--src/or/connection.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 38859a9010..d2ee1ae731 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);