diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-10-17 21:26:22 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-10-17 21:26:22 +0000 |
commit | 54ac72f6b0337f58a37e2187f344d5b17bef58c3 (patch) | |
tree | 597c7873202b62c5e30e8e025e442159f1ca6b8b /src/or | |
parent | 088c1fac39d209bd01d1744303d1cc440d635792 (diff) | |
download | tor-54ac72f6b0337f58a37e2187f344d5b17bef58c3.tar.gz tor-54ac72f6b0337f58a37e2187f344d5b17bef58c3.zip |
r15887@catbus: nickm | 2007-10-17 17:25:32 -0400
When a networkstatus consensus download fails, do not wait 60 seconds to decide whether to retry. (Also, log the time at which we'll try to replace the current networkstatus.)
svn:r12005
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/main.c | 3 | ||||
-rw-r--r-- | src/or/networkstatus.c | 15 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/or/main.c b/src/or/main.c index 5616fd1794..cfe4745642 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -997,9 +997,6 @@ run_scheduled_events(time_t now) networkstatus_v2_list_clean(now); /* Remove dead routers. */ routerlist_remove_old_routers(); -#if 0 - networkstatus_v2_list_update_recent(now); -#endif /* Also, once per minute, check whether we want to download any * networkstatus documents. diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index e7bb6405f5..8a174482e5 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -728,6 +728,8 @@ static void update_consensus_networkstatus_downloads(time_t now) { or_options_t *options = get_options(); + if (!networkstatus_get_live_consensus(now)) + time_to_download_next_consensus = now; if (time_to_download_next_consensus > now) return; if (authdir_mode_v3(options)) @@ -747,6 +749,8 @@ void networkstatus_consensus_download_failed(int status_code) { download_status_failed(&consensus_dl_status, status_code); + /* Retry immediately, if appropriate. */ + update_consensus_networkstatus_downloads(time(NULL)); } /** DOCDOC */ @@ -755,8 +759,8 @@ update_consensus_networkstatus_fetch_time(time_t now) { or_options_t *options = get_options(); /* XXXX020 call this when DirPort switches on or off. NMNM */ - if (current_consensus) { - const networkstatus_vote_t *c = current_consensus; + networkstatus_vote_t *c = networkstatus_get_live_consensus(now); + if (c) { time_t start; long interval; if (dirserver_mode(options)) { @@ -772,9 +776,16 @@ update_consensus_networkstatus_fetch_time(time_t now) interval = 1; tor_assert(start+interval < c->valid_until); time_to_download_next_consensus = start + crypto_rand_int(interval); + { + char tbuf[ISO_TIME_LEN+1]; + format_local_iso_time(tbuf, time_to_download_next_consensus); + log_info(LD_DIR, "Have a live consensus; fetching next one at %s.",tbuf); + } } else { time_to_download_next_consensus = now; + log_info(LD_DIR, "No live consensus; we should fetch one immediately."); } + } /** Return 1 if there's a reason we shouldn't try any directory |