[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r12102: When our directory status or our v3 authority status changes (in tor/trunk: . src/or)



Author: nickm
Date: 2007-10-22 12:32:04 -0400 (Mon, 22 Oct 2007)
New Revision: 12102

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/config.c
   tor/trunk/src/or/networkstatus.c
   tor/trunk/src/or/or.h
   tor/trunk/src/or/routerlist.c
Log:
 r16032@catbus:  nickm | 2007-10-22 11:56:53 -0400
 When our directory status or our v3 authority status changes, reschedule operations as appropriate. (Fixes some xxxx020 items)



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r16032] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-22 16:32:01 UTC (rev 12101)
+++ tor/trunk/ChangeLog	2007-10-22 16:32:04 UTC (rev 12102)
@@ -31,6 +31,8 @@
     - Allow tor-gencert to generate a new certificate without replacing the
       signing key.
     - Allow certificates to include an address.
+    - When we change our directory-cache settings, reschedule all voting
+      and download operations.
 
   o Minor features (router descriptor cache):
     - If we find a cached-routers file that's been sitting around for more

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2007-10-22 16:32:01 UTC (rev 12101)
+++ tor/trunk/src/or/config.c	2007-10-22 16:32:04 UTC (rev 12102)
@@ -1119,6 +1119,17 @@
       options_transition_affects_descriptor(old_options, options))
     mark_my_descriptor_dirty();
 
+  /* We may need to reschedule some directory stuff if our status changed. */
+  if (authdir_mode_v3(options) && !authdir_mode_v3(old_options))
+    dirvote_recalculate_timing(options, time(NULL));
+  if (!bool_eq(dirserver_mode(options), dirserver_mode(old_options))) {
+    /* Make sure update_router_have_min_dir_info gets called. */
+    router_dir_info_changed();
+    /* We might need to download a new consensus status later or sooner than
+     * we had expected. */
+    update_consensus_networkstatus_fetch_time(time(NULL));
+  }
+
   return 0;
 }
 

Modified: tor/trunk/src/or/networkstatus.c
===================================================================
--- tor/trunk/src/or/networkstatus.c	2007-10-22 16:32:01 UTC (rev 12101)
+++ tor/trunk/src/or/networkstatus.c	2007-10-22 16:32:04 UTC (rev 12102)
@@ -776,11 +776,10 @@
 
 /** Update the time at which we'll consider replacing the current
  * consensus. */
-static void
+void
 update_consensus_networkstatus_fetch_time(time_t now)
 {
   or_options_t *options = get_options();
-  /* XXXX020 call this when DirPort switches on or off. NMNM */
   networkstatus_vote_t *c = networkstatus_get_live_consensus(now);
   if (c) {
     long dl_interval;

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-10-22 16:32:01 UTC (rev 12101)
+++ tor/trunk/src/or/or.h	2007-10-22 16:32:04 UTC (rev 12102)
@@ -3103,6 +3103,7 @@
 const char *networkstatus_get_router_digest_by_nickname(const char *nickname);
 int networkstatus_nickname_is_unnamed(const char *nickname);
 void networkstatus_consensus_download_failed(int status_code);
+void update_consensus_networkstatus_fetch_time(time_t now);
 int should_delay_dir_fetches(or_options_t *options);
 void update_networkstatus_downloads(time_t now);
 networkstatus_v2_t *networkstatus_v2_get_by_digest(const char *digest);

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-10-22 16:32:01 UTC (rev 12101)
+++ tor/trunk/src/or/routerlist.c	2007-10-22 16:32:04 UTC (rev 12102)
@@ -3863,7 +3863,6 @@
 static void
 update_router_have_minimum_dir_info(void)
 {
-  /*XXX020 call when dirserver_mode() changes. */
   int num_present = 0, num_usable=0;
   time_t now = time(NULL);
   int res;