[or-cvs] do the other half of dirport reachability testing.

arma at seul.org arma at seul.org
Thu Sep 29 23:59:38 UTC 2005


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

Modified Files:
	directory.c 
Log Message:
do the other half of dirport reachability testing.
it should be back and working now.


Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.293
retrieving revision 1.294
diff -u -d -r1.293 -r1.294
--- directory.c	29 Sep 2005 23:26:42 -0000	1.293
+++ directory.c	29 Sep 2005 23:59:36 -0000	1.294
@@ -1008,10 +1008,14 @@
       tor_free(body); tor_free(headers); tor_free(reason);
       return -1;
     }
-    /* as we learn from them, we remove them from 'which' */
-    router_load_routers_from_string(body, 0, which);
-    directory_info_has_arrived(time(NULL), 0);
     if (which) {
+      /* We only call these if it's a "fp/" request, since
+       * it's the only way we'll be adding new server descriptors
+       * and thus the only way we'd affect has_fetched_directory. */
+
+      /* as we learn from them, we remove them from 'which' */
+      router_load_routers_from_string(body, 0, which);
+      directory_info_has_arrived(time(NULL), 0);
       log_fn(LOG_NOTICE, "Received %d/%d routers.",
              n_asked_for-smartlist_len(which), n_asked_for);
       if (smartlist_len(which)) {
@@ -1020,6 +1024,16 @@
       SMARTLIST_FOREACH(which, char *, cp, tor_free(cp));
       smartlist_free(which);
     }
+    if (conn->requested_resource &&
+        !strcmpstart(conn->requested_resource,"authority")) {
+      /* this might have been a dirport reachability test. see if it is. */
+      routerinfo_t *me = router_get_my_routerinfo();
+      if (me &&
+          !memcmp(me->identity_digest, conn->identity_digest, DIGEST_LEN) &&
+          me->addr == conn->addr &&
+          me->dir_port == conn->port)
+        router_dirport_found_reachable();
+    }
   }
 
   if (conn->purpose == DIR_PURPOSE_UPLOAD_DIR) {



More information about the tor-commits mailing list