[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r12167: Tolerate a slightly dead consensus when deciding whether to (in tor/trunk: . src/or)
Author: nickm
Date: 2007-10-24 21:53:49 -0400 (Wed, 24 Oct 2007)
New Revision: 12167
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/src/or/networkstatus.c
tor/trunk/src/or/or.h
tor/trunk/src/or/routerlist.c
Log:
r16115@catbus: nickm | 2007-10-24 21:52:33 -0400
Tolerate a slightly dead consensus when deciding whether to download descriptors and build circuits.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r16115] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-10-25 01:45:36 UTC (rev 12166)
+++ tor/trunk/ChangeLog 2007-10-25 01:53:49 UTC (rev 12167)
@@ -42,6 +42,9 @@
consensus that we already have (or one that isn't valid) as a failure,
and count failing to get the certificates after 20 minutes as a
failure.
+ - Build circuits and download descriptors even if our consensus is a
+ little expired. (This feature will go away once authorities are more
+ reliable.)
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/networkstatus.c
===================================================================
--- tor/trunk/src/or/networkstatus.c 2007-10-25 01:45:36 UTC (rev 12166)
+++ tor/trunk/src/or/networkstatus.c 2007-10-25 01:53:49 UTC (rev 12167)
@@ -1122,6 +1122,19 @@
return NULL;
}
+/* XXXX020 remove this in favor of get_live_consensus. */
+networkstatus_vote_t *
+networkstatus_get_reasonably_live_consensus(time_t now)
+{
+#define REASONABLY_LIVE_TIME (24*60*60)
+ if (current_consensus &&
+ current_consensus->valid_after <= now+REASONABLY_LIVE_TIME &&
+ now <= current_consensus->valid_until)
+ return current_consensus;
+ else
+ return NULL;
+}
+
/** Copy all the ancillary information (like router download status and so on)
* from <b>old_c</b> to <b>new_c</b>. */
static void
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-10-25 01:45:36 UTC (rev 12166)
+++ tor/trunk/src/or/or.h 2007-10-25 01:53:49 UTC (rev 12167)
@@ -3112,6 +3112,7 @@
networkstatus_v2_t *networkstatus_v2_get_by_digest(const char *digest);
networkstatus_vote_t *networkstatus_get_latest_consensus(void);
networkstatus_vote_t *networkstatus_get_live_consensus(time_t now);
+networkstatus_vote_t *networkstatus_get_reasonably_live_consensus(time_t now);
int networkstatus_set_current_consensus(const char *consensus, int from_cache,
int was_waiting_for_certs);
void networkstatus_note_certs_arrived(void);
Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c 2007-10-25 01:45:36 UTC (rev 12166)
+++ tor/trunk/src/or/routerlist.c 2007-10-25 01:53:49 UTC (rev 12167)
@@ -3685,7 +3685,8 @@
smartlist_t *downloadable = smartlist_create();
int authdir = authdir_mode(options);
int dirserver = dirserver_mode(options);
- networkstatus_vote_t *consensus = networkstatus_get_live_consensus(now);
+ networkstatus_vote_t *consensus =
+ networkstatus_get_reasonably_live_consensus(now);
int n_delayed=0, n_have=0, n_would_reject=0, n_wouldnt_use=0,
n_inprogress=0;
@@ -3864,7 +3865,7 @@
int res;
or_options_t *options = get_options();
const networkstatus_vote_t *consensus =
- networkstatus_get_live_consensus(now);
+ networkstatus_get_reasonably_live_consensus(now);
if (!consensus) {
res = 0;