[or-cvs] if we as a directory mirror don"t know of any v1 directory

arma at seul.org arma at seul.org
Wed Mar 15 00:10:15 UTC 2006


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

Modified Files:
	main.c or.h routerlist.c 
Log Message:
if we as a directory mirror don't know of any v1 directory
authorities, then don't try to cache any v1 directories.


Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.633
retrieving revision 1.634
diff -u -p -d -r1.633 -r1.634
--- main.c	13 Mar 2006 19:33:46 -0000	1.633
+++ main.c	15 Mar 2006 00:10:13 -0000	1.634
@@ -826,7 +826,8 @@ run_scheduled_events(time_t now)
     if (options->DirPort && !options->V1AuthoritativeDir) {
       /* XXX actually, we should only do this if we want to advertise
        * our dirport. not simply if we configured one. -RD */
-      directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL, 1);
+      if (any_trusted_dir_supports_v1())
+        directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL, 1);
     }
 
     time_to_fetch_directory = now + get_dir_fetch_period(options);

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.805
retrieving revision 1.806
diff -u -p -d -r1.805 -r1.806
--- or.h	12 Mar 2006 23:31:16 -0000	1.805
+++ or.h	15 Mar 2006 00:10:13 -0000	1.806
@@ -2341,6 +2341,7 @@ void add_trusted_dir_server(const char *
                             const char *address, uint16_t port,
                             const char *digest, int supports_v1);
 void clear_trusted_dir_servers(void);
+int any_trusted_dir_supports_v1(void);
 networkstatus_t *networkstatus_get_by_digest(const char *digest);
 local_routerstatus_t *router_get_combined_status_by_digest(const char *digest);
 void update_networkstatus_downloads(time_t now);

Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.455
retrieving revision 1.456
diff -u -p -d -r1.455 -r1.456
--- routerlist.c	14 Mar 2006 23:40:37 -0000	1.455
+++ routerlist.c	15 Mar 2006 00:10:13 -0000	1.456
@@ -2678,6 +2678,17 @@ clear_trusted_dir_servers(void)
   }
 }
 
+/** Return 1 if any trusted dir server supports v1 directories,
+ * else return 0. */
+int
+any_trusted_dir_supports_v1(void)
+{
+  if (trusted_dir_servers)
+    SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ent,
+                      if (ent->is_v1_authority) return 1);
+  return 0;
+}
+
 /** Return the network status with a given identity digest. */
 networkstatus_t *
 networkstatus_get_by_digest(const char *digest)



More information about the tor-commits mailing list