[or-cvs] Make running-routers fetch (apparently) work

Nick Mathewson nickm at seul.org
Sun Nov 14 21:35:33 UTC 2004


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

Modified Files:
	directory.c routerparse.c 
Log Message:
Make running-routers fetch (apparently) work

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -d -r1.165 -r1.166
--- directory.c	12 Nov 2004 21:59:27 -0000	1.165
+++ directory.c	14 Nov 2004 21:35:30 -0000	1.166
@@ -140,10 +140,10 @@
     });
 }
 
-/** Start a connection to a random running directory server, using
- * connection purpose 'purpose' requesting 'payload' (length
- * 'payload_len').  The purpose should be one of
- * 'DIR_PURPOSE_FETCH_DIR' or 'DIR_PURPOSE_FETCH_RENDDESC'.
+/** Start a connection to a random running directory server, using connection
+ * purpose 'purpose' requesting 'payload' (length 'payload_len').  The purpose
+ * should be one of 'DIR_PURPOSE_FETCH_DIR' or 'DIR_PURPOSE_FETCH_RENDDESC' or
+ * 'DIR_PURPOSE_FETCH_RUNNING_LIST.'
  */
 void
 directory_get_from_dirserver(uint8_t purpose, const char *resource)
@@ -163,6 +163,9 @@
         ds = router_pick_trusteddirserver(1, get_options()->FascistFirewall);
       }
     }
+  } else if (purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
+    /* right now, running-routers isn't cached, so ask a trusted directory */
+    ds = router_pick_trusteddirserver(0, get_options()->FascistFirewall);
   } else { // (purpose == DIR_PURPOSE_FETCH_RENDDESC)
     /* only ask authdirservers, any of them will do */
     /* Never use fascistfirewall; we're going via Tor. */
@@ -241,6 +244,9 @@
     case DIR_PURPOSE_UPLOAD_RENDDESC:
       log_fn(LOG_DEBUG,"initiating hidden-service descriptor upload");
       break;
+    case DIR_PURPOSE_FETCH_RUNNING_LIST:
+      log_fn(LOG_DEBUG,"initiating running-routers fetch");
+      break;
     default:
       log_fn(LOG_ERR, "Unrecognized directory connection purpose.");
       tor_assert(0);
@@ -270,7 +276,8 @@
   conn->state = DIR_CONN_STATE_CONNECTING;
 
   if(purpose == DIR_PURPOSE_FETCH_DIR ||
-     purpose == DIR_PURPOSE_UPLOAD_DIR) {
+     purpose == DIR_PURPOSE_UPLOAD_DIR ||
+     purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
     /* then we want to connect directly */
     switch(connection_connect(conn, conn->address, addr, dir_port)) {
       case -1:

Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerparse.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- routerparse.c	12 Nov 2004 19:39:13 -0000	1.77
+++ routerparse.c	14 Nov 2004 21:35:30 -0000	1.78
@@ -529,9 +529,10 @@
   for (i=0;i<tok->n_args;++i) {
     smartlist_add(new_list->running_routers, tok->args[i]);
   }
+  tok->n_args = 0; /* Don't free the elements of tok->args. */
 
   if (!(tok = find_first_by_keyword(tokens, K_DIRECTORY_SIGNATURE))) {
-    log_fn(LOG_WARN, "Missing signature on directory");
+    log_fn(LOG_WARN, "Missing signature on running-routers");
     goto err;
   }
   declared_key = find_dir_signing_key(str);



More information about the tor-commits mailing list