[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[PATCH] dns_server_port not getting stored



Not sure why I didn't notice this one before.

There's a race condition (or something) when you unset dnsport - because the 
conn disappears but the eventdns callback doesn't. The patch fixes it.

Also added the conn-type to a couple of condition statements that it seemed to 
belong to.

-- 

Browse Anonymously Anywhere	- http://anonymityanywhere.com
TorK	- KDE Anonymity Manager	- http://tork.sf.net
KlamAV	- KDE Anti-Virus 	- http://www.klamav.net

Index: src/or/hibernate.c
===================================================================
--- src/or/hibernate.c	(revision 10923)
+++ src/or/hibernate.c	(working copy)
@@ -771,6 +771,7 @@
   while ((conn = connection_get_by_type(CONN_TYPE_OR_LISTENER)) ||
          (conn = connection_get_by_type(CONN_TYPE_AP_LISTENER)) ||
          (conn = connection_get_by_type(CONN_TYPE_AP_TRANS_LISTENER)) ||
+         (conn = connection_get_by_type(CONN_TYPE_AP_DNS_LISTENER)) ||
          (conn = connection_get_by_type(CONN_TYPE_AP_NATD_LISTENER)) ||
          (conn = connection_get_by_type(CONN_TYPE_DIR_LISTENER))) {
     log_info(LD_NET,"Closing listener type %d", conn->type);
Index: src/or/connection.c
===================================================================
--- src/or/connection.c	(revision 10923)
+++ src/or/connection.c	(working copy)
@@ -2423,6 +2423,7 @@
   if (conn->type == CONN_TYPE_OR_LISTENER ||
       conn->type == CONN_TYPE_AP_LISTENER ||
       conn->type == CONN_TYPE_AP_TRANS_LISTENER ||
+      conn->type == CONN_TYPE_AP_DNS_LISTENER ||
       conn->type == CONN_TYPE_AP_NATD_LISTENER ||
       conn->type == CONN_TYPE_DIR_LISTENER ||
       conn->type == CONN_TYPE_CONTROL_LISTENER)
Index: src/or/dnsserv.c
===================================================================
--- src/or/dnsserv.c	(revision 10923)
+++ src/or/dnsserv.c	(working copy)
@@ -255,7 +255,8 @@
   tor_assert(conn->s);
   tor_assert(conn->type == CONN_TYPE_AP_DNS_LISTENER);
 
-  evdns_add_server_port(conn->s, 0, evdns_server_callback, NULL);
+  conn->dns_server_port = evdns_add_server_port(conn->s, 0,
+                                                evdns_server_callback, NULL);
 }
 
 /** Free the evdns server port for <b>conn</b>, which must be an