[or-cvs] when the dns resolve is cancelled, or fails, be sure to rem...

Roger Dingledine arma at seul.org
Fri May 21 12:25:17 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	circuitlist.c connection.c dns.c 
Log Message:
when the dns resolve is cancelled, or fails, be sure to remove
conn from circ->resolving_streams

otherwise it gets freed and stays there, causing seg faults.


Index: circuitlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitlist.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- circuitlist.c	19 May 2004 23:51:39 -0000	1.4
+++ circuitlist.c	21 May 2004 12:25:15 -0000	1.5
@@ -200,7 +200,7 @@
 }
 
 /** Return a circ such that circ is attached to <b>conn</b>, either as
- * p_conn, n-conn, or in p_streams or n_streams.
+ * p_conn, n-conn, or in p_streams or n_streams or resolving_streams.
  *
  * Return NULL if no such circuit exists.
  */

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.228
retrieving revision 1.229
diff -u -d -r1.228 -r1.229
--- connection.c	20 May 2004 04:16:43 -0000	1.228
+++ connection.c	21 May 2004 12:25:15 -0000	1.229
@@ -208,8 +208,10 @@
       }
       break;
     case CONN_TYPE_EXIT:
-      if (conn->state == EXIT_CONN_STATE_RESOLVING)
+      if (conn->state == EXIT_CONN_STATE_RESOLVING) {
+        circuit_detach_stream(circuit_get_by_conn(conn), conn);
         connection_dns_remove(conn);
+      }
       break;
     case CONN_TYPE_DNSWORKER:
       if (conn->state == DNSWORKER_STATE_BUSY) {

Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- dns.c	19 May 2004 23:32:20 -0000	1.94
+++ dns.c	21 May 2004 12:25:15 -0000	1.95
@@ -436,6 +436,7 @@
                                 connection_mark_for_close macro */
       /* prevent double-remove. */
       pendconn->state = EXIT_CONN_STATE_RESOLVEFAILED;
+      circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
       connection_edge_end(pendconn, END_STREAM_REASON_MISC, pendconn->cpath_layer);
       connection_mark_for_close(pendconn);
       connection_free(pendconn);



More information about the tor-commits mailing list