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

[or-cvs] Fix bug on dns_found_answer from mark_to_close stuff.



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

Modified Files:
	dns.c 
Log Message:
Fix bug on dns_found_answer from mark_to_close stuff.

Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- dns.c	28 Feb 2004 21:49:10 -0000	1.55
+++ dns.c	28 Feb 2004 21:52:58 -0000	1.56
@@ -297,16 +297,19 @@
 
   while(resolve->pending_connections) {
     pend = resolve->pending_connections;
-    assert_connection_ok(pend->conn,0);
+    assert_connection_ok(pend->conn,time(NULL));
     pend->conn->addr = resolve->addr;
     if(resolve->state == CACHE_STATE_FAILED) {
+      /* This calls dns_cancel_pending_resolve, which removes pend
+       * from the list, so we don't have to do it.  Beware of
+       * modify-while-iterating bugs hereabouts! */
       connection_mark_for_close(pend->conn, END_STREAM_REASON_RESOLVEFAILED);
+      assert(resolve->pending_connections != pend);
     } else {
-      assert_connection_ok(pend->conn, time(NULL));
       connection_exit_connect(pend->conn);
+      resolve->pending_connections = pend->next;
+      free(pend);
     }
-    resolve->pending_connections = pend->next;
-    free(pend);
   }
 }