[or-cvs] better cleanups as i figure out what"s going on

arma at seul.org arma at seul.org
Thu Sep 29 23:26:44 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 main.c 
Log Message:
better cleanups as i figure out what's going on


Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.292
retrieving revision 1.293
diff -u -d -r1.292 -r1.293
--- directory.c	29 Sep 2005 23:06:48 -0000	1.292
+++ directory.c	29 Sep 2005 23:26:42 -0000	1.293
@@ -294,8 +294,9 @@
   }
 }
 
-/** Called when an attempt to download one or network status documents
- * on connection <b>conn</b> failed.
+/** Called when an attempt to download one or more network status
+ * documents on connection <b>conn</b> failed. Decide whether to
+ * retry the fetch now, later, or never.
  */
 static void
 connection_dir_download_networkstatus_failed(connection_t *conn)
@@ -324,7 +325,7 @@
   }
 }
 
-/** Called when an attempt to download one or network status documents
+/** Called when an attempt to download one or more router descriptors
  * on connection <b>conn</b> failed.
  */
 static void
@@ -958,6 +959,7 @@
       char *next = strstr(cp, "\nnetwork-status-version");
       if (next)
         next[1] = '\0';
+      /* learn from it, and then remove it from 'which' */
       if (router_set_networkstatus(cp, time(NULL), NS_FROM_DIR, which)<0)
         break;
       if (next) {
@@ -967,7 +969,7 @@
       else
         break;
     }
-    routers_update_all_from_networkstatus();/*launches router downloads*/
+    routers_update_all_from_networkstatus(); /*launches router downloads*/
     directory_info_has_arrived(time(NULL), 0);
     if (which) {
       if (smartlist_len(which)) {
@@ -1006,9 +1008,10 @@
       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) {
-      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)) {

Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.559
retrieving revision 1.560
diff -u -d -r1.559 -r1.560
--- main.c	23 Sep 2005 18:49:37 -0000	1.559
+++ main.c	29 Sep 2005 23:26:42 -0000	1.560
@@ -529,8 +529,8 @@
     return 30*60;
 }
 
-/** This function is called whenever we successfully pull down some directory
- * information. */
+/** This function is called whenever we successfully pull down some new
+ * network statuses or server descriptors. */
 void
 directory_info_has_arrived(time_t now, int from_cache)
 {



More information about the tor-commits mailing list