[or-cvs] r6922: Add more asserts in dns_found_answer. This may confirm my th (tor/trunk/src/or)

nickm at seul.org nickm at seul.org
Thu Jul 27 17:16:10 UTC 2006


Author: nickm
Date: 2006-07-27 13:16:10 -0400 (Thu, 27 Jul 2006)
New Revision: 6922

Modified:
   tor/trunk/src/or/dns.c
Log:
Add more asserts in dns_found_answer.  This may confirm my theory that dns_purge_resolve is the culprit.

Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2006-07-27 14:26:21 UTC (rev 6921)
+++ tor/trunk/src/or/dns.c	2006-07-27 17:16:10 UTC (rev 6922)
@@ -633,9 +633,11 @@
     resolve->addr = addr;
     resolve->expire = time(NULL) + dns_get_expiry_ttl(ttl);
     resolve->ttl = ttl;
+    assert_resolve_ok(resolve);
     insert_resolve(resolve);
     return;
   }
+  assert_resolve_ok(resolve);
 
   if (resolve->state != CACHE_STATE_PENDING) {
     /* XXXX Maybe update addr? or check addr for consistency? Or let
@@ -661,11 +663,11 @@
 
   while (resolve->pending_connections) {
     pend = resolve->pending_connections;
-    assert_connection_ok(TO_CONN(pend->conn),time(NULL));
-    pend->conn->_base.addr = resolve->addr;
-    pend->conn->address_ttl = resolve->ttl;
     pendconn = pend->conn; /* don't pass complex things to the
                               connection_mark_for_close macro */
+    assert_connection_ok(TO_CONN(pendconn),time(NULL));
+    pendconn->_base.addr = resolve->addr;
+    pendconn->address_ttl = resolve->ttl;
 
     if (resolve->state == CACHE_STATE_FAILED) {
       /* prevent double-remove. */
@@ -711,6 +713,8 @@
     resolve->pending_connections = pend->next;
     tor_free(pend);
   }
+  assert_resolve_ok(resolve);
+  assert_cache_ok();
 
   if (outcome == DNS_RESOLVE_FAILED_TRANSIENT) { /* remove from cache */
     dns_purge_resolve(resolve);



More information about the tor-commits mailing list