aboutsummaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-12-23 14:25:37 -0500
committerNick Mathewson <nickm@torproject.org>2014-12-23 14:25:37 -0500
commitf9ba0b76cd5b447b86efa87eb115d12d6f0be2e7 (patch)
treebac54f1a900879e11c417bbe759a6c77cfb2cad0 /src/or/networkstatus.c
parentd7776315df8ec12a496127a5d5c3c9fcbec9c092 (diff)
parent8a8797f1e45e6124ac93e3a8fb277b5758d7c935 (diff)
downloadtor-f9ba0b76cd5b447b86efa87eb115d12d6f0be2e7.tar.gz
tor-f9ba0b76cd5b447b86efa87eb115d12d6f0be2e7.zip
Merge remote-tracking branch 'teor/bug13718-consensus-interval'
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 21efdd129d..9b24405951 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -832,6 +832,10 @@ update_consensus_networkstatus_fetch_time_impl(time_t now, int flav)
a crazy-fast voting interval, though, 2 minutes may be too
much. */
min_sec_before_caching = interval/16;
+ /* make sure we always delay by at least a second before caching */
+ if (min_sec_before_caching == 0) {
+ min_sec_before_caching = 1;
+ }
}
if (directory_fetches_dir_info_early(options)) {
@@ -863,8 +867,16 @@ update_consensus_networkstatus_fetch_time_impl(time_t now, int flav)
dl_interval = (c->valid_until - start) - min_sec_before_caching;
}
}
+ /* catch low dl_interval in crazy-fast networks */
if (dl_interval < 1)
dl_interval = 1;
+ /* catch late start in crazy-fast networks */
+ if (start+dl_interval >= c->valid_until)
+ start = c->valid_until - dl_interval - 1;
+ log_debug(LD_DIR,
+ "fresh_until: %ld start: %ld "
+ "dl_interval: %ld valid_until: %ld ",
+ c->fresh_until, start, dl_interval, c->valid_until);
/* We must not try to replace c while it's still fresh: */
tor_assert(c->fresh_until < start);
/* We must download the next one before c is invalid: */