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

[or-cvs] r13342: Periodically check whether we have an expired consensus netw (in tor/trunk: . src/or)



Author: nickm
Date: 2008-01-30 17:52:46 -0500 (Wed, 30 Jan 2008)
New Revision: 13342

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/main.c
Log:
 r17854@catbus:  nickm | 2008-01-30 17:52:43 -0500
 Periodically check whether we have an expired consensus networkstatus.  If we do, and we think we have enough directory info, then call router_dir_info_changed().  Fixes bug 401.  This bug was deferred from 0.1.2.x, but fixing it there is nontrivial.



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

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-01-30 22:23:44 UTC (rev 13341)
+++ tor/trunk/ChangeLog	2008-01-30 22:52:46 UTC (rev 13342)
@@ -11,6 +11,9 @@
     - When connecting to a bridge without specifying its key, insert
       the connection into the identity-to-connection map as soon as
       a key is learned.  Fixes bug 574.  Bugfix on 0.2.0.x.
+    - When our consensus networkstatus has been expired for a while, stop
+      being willing to build circuits using it.  Fixes bug 401.  Bugfix on
+      0.1.2.x.
 
 
 Changes in version 0.2.0.18-alpha - 2008-01-25

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2008-01-30 22:23:44 UTC (rev 13341)
+++ tor/trunk/src/or/main.c	2008-01-30 22:52:46 UTC (rev 13342)
@@ -818,6 +818,7 @@
   static time_t time_to_save_stability = 0;
   static time_t time_to_clean_caches = 0;
   static time_t time_to_recheck_bandwidth = 0;
+  static time_t time_to_check_for_expired_networkstatus = 0;
   or_options_t *options = get_options();
   int i;
   int have_dir_info;
@@ -932,6 +933,22 @@
     time_to_check_v3_certificate = now + CHECK_V3_CERTIFICATE_INTERVAL;
   }
 
+  /* 1f. Check whether our networkstatus has expired.
+   */
+  if (time_to_check_for_expired_networkstatus < now) {
+    networkstatus_vote_t *ns = networkstatus_get_latest_consensus();
+    /*XXXX020 this value needs to be the same as REASONABLY_LIVE_TIME in
+     * networkstatus_get_reasonably_live_consensus(), but that value is way
+     * way too high.  Arma: is the bridge issue there resolved yet? -NM */
+#define NS_EXPIRY_SLOP (24*60*60)
+    if (ns && ns->valid_until < now+NS_EXPIRY_SLOP &&
+        router_have_minimum_dir_info()) {
+      router_dir_info_changed();
+    }
+#define CHECK_EXPIRED_NS_INTERVAL (2*60)
+    time_to_check_for_expired_networkstatus = now + CHECK_EXPIRED_NS_INTERVAL;
+  }
+
   /** 2. Periodically, we consider getting a new directory, getting a
    * new running-routers list, and/or force-uploading our descriptor
    * (if we've passed our internal checks). */