[or-cvs] Bugfix: When a dns request failed, we would detach any "res...

Nick Mathewson nickm at seul.org
Tue Sep 21 16:42:10 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv9473/or

Modified Files:
	dns.c 
Log Message:
Bugfix: When a dns request failed, we would detach any "resolving" streams from the circuit before we would send a the resolve_failed cells.

Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- dns.c	25 Aug 2004 05:26:09 -0000	1.106
+++ dns.c	21 Sep 2004 16:42:07 -0000	1.107
@@ -494,11 +494,16 @@
     if(resolve->state == CACHE_STATE_FAILED) {
       /* prevent double-remove. */
       pendconn->state = EXIT_CONN_STATE_RESOLVEFAILED;
-      circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
-      if (pendconn->purpose == EXIT_PURPOSE_CONNECT)
+      if (pendconn->purpose == EXIT_PURPOSE_CONNECT) {
+        /*XXXX can we safely raise the detach here to happen after we
+         * send the end cell? */
+        circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
         connection_edge_end(pendconn, END_STREAM_REASON_MISC, pendconn->cpath_layer);
-      else
+      } else {
         send_resolved_cell(pendconn, RESOLVED_TYPE_ERROR);
+        /* This detach must happen after we send the resolved cell. */
+        circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
+      }
       connection_free(pendconn);
     } else {
       if (pendconn->purpose == EXIT_PURPOSE_CONNECT) {



More information about the tor-commits mailing list