[or-cvs] r10849: a few fixes for bug 463. needs a changelog. might need more (tor/trunk/src/or)

arma at seul.org arma at seul.org
Tue Jul 17 02:53:18 UTC 2007


Author: arma
Date: 2007-07-16 22:53:17 -0400 (Mon, 16 Jul 2007)
New Revision: 10849

Modified:
   tor/trunk/src/or/dns.c
Log:
a few fixes for bug 463. needs a changelog. might need more fixes.


Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2007-07-16 19:47:03 UTC (rev 10848)
+++ tor/trunk/src/or/dns.c	2007-07-17 02:53:17 UTC (rev 10849)
@@ -536,8 +536,8 @@
   r = dns_resolve_impl(exitconn, is_resolve, oncirc, &hostname);
   switch (r) {
     case 1:
-      /* We got an answer without a lookup.  (Either the answer was
-       * cached, or it was obvious (like an IP address).)*/
+      /* We got an answer without a lookup -- either the answer was
+       * cached, or it was obvious (like an IP address). */
       if (is_resolve) {
         /* Send the answer back right now, and detach. */
         if (hostname)
@@ -562,7 +562,7 @@
     case -2:
     case -1:
       /* The request failed before it could start: cancel this connection,
-       * and stop everybody waiting forthe same connection. */
+       * and stop everybody waiting for the same connection. */
       if (is_resolve) {
         send_resolved_cell(exitconn,
              (r == -1) ? RESOLVED_TYPE_ERROR : RESOLVED_TYPE_ERROR_TRANSIENT);
@@ -578,7 +578,7 @@
         // If it's marked for close, it's on closeable_connection_lst in
         // main.c.  If it's on the closeable list, it will get freed from
         // main.c. -NM
-        // "<armadev> If that's true, there are other bugs arond, where we
+        // "<armadev> If that's true, there are other bugs around, where we
         //  don't check if it's marked, and will end up double-freeing."
       }
       break;
@@ -822,10 +822,13 @@
   strlcpy(search.address, address, sizeof(search.address));
 
   resolve = HT_FIND(cache_map, &cache_root, &search);
-  if (!resolve || resolve->state != CACHE_STATE_PENDING) {
-    log_notice(LD_BUG,"Address %s is not pending. Dropping.",
-               escaped_safe_str(address));
+  if (!resolve)
     return;
+
+  if(resolve->state != CACHE_STATE_PENDING) {
+    log_notice(LD_BUG,"Address %s is not pending (state %d). Dropping.",
+               escaped_safe_str(address), resolve->state);
+    return;
   }
 
   if (!resolve->pending_connections) {



More information about the tor-commits mailing list