[or-cvs] Clean up should-i-go-to-the-dirserv logic a little: All ser...

Nick Mathewson nickm at seul.org
Thu Sep 8 18:14:04 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv4383/src/or

Modified Files:
	directory.c 
Log Message:
Clean up should-i-go-to-the-dirserv logic a little: All servers with DirPorts should get their directories from the source

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.258
retrieving revision 1.259
diff -u -d -r1.258 -r1.259
--- directory.c	8 Sep 2005 16:18:28 -0000	1.258
+++ directory.c	8 Sep 2005 18:14:01 -0000	1.259
@@ -113,7 +113,9 @@
 {
   if (purpose == DIR_PURPOSE_FETCH_DIR ||
       purpose == DIR_PURPOSE_UPLOAD_DIR ||
-      purpose == DIR_PURPOSE_FETCH_RUNNING_LIST)
+      purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ||
+      purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
+      purpose == DIR_PURPOSE_FETCH_SERVERDESC)
     return 0;
   return 1;
 }
@@ -162,12 +164,10 @@
   routerinfo_t *r = NULL;
   trusted_dir_server_t *ds = NULL;
   int fascistfirewall = firewall_is_fascist();
-  int directconn = purpose == DIR_PURPOSE_FETCH_DIR ||
-                   purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ||
-                   purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
-                   purpose == DIR_PURPOSE_FETCH_SERVERDESC;
-  int fetch_fresh_first = advertised_server_mode();
-  int priv = purpose_is_private(purpose);
+  or_options_t *options = get_options();
+  int fetch_fresh_first = server_mode(options) && options->DirPort != 0;
+  int directconn = !purpose_is_private(purpose);
+
   int need_v1_support = purpose == DIR_PURPOSE_FETCH_DIR ||
                         purpose == DIR_PURPOSE_FETCH_RUNNING_LIST;
   int need_v2_support = purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
@@ -213,9 +213,9 @@
   }
 
   if (r)
-    directory_initiate_command_router(r, purpose, priv, resource, NULL, 0);
+    directory_initiate_command_router(r, purpose, !directconn, resource, NULL, 0);
   else if (ds)
-    directory_initiate_command_trusted_dir(ds, purpose, priv, resource, NULL, 0);
+    directory_initiate_command_trusted_dir(ds, purpose, !directconn, resource, NULL, 0);
   else {
     log_fn(LOG_NOTICE,"No running dirservers known. Will try again later. (purpose %d)",
            purpose);



More information about the tor-commits mailing list