diff options
author | teor <teor2345@gmail.com> | 2014-12-20 21:53:00 +1100 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2014-12-24 06:13:32 +1100 |
commit | 1ee41b3eef4b5e561c7c73e79885fe858dac6d80 (patch) | |
tree | 0a751121774b65ef5a82b0a526eea51534000a52 /src/or/networkstatus.c | |
parent | 083c58f126a4390b96b0e3f14d809502d8702f3d (diff) | |
download | tor-1ee41b3eef4b5e561c7c73e79885fe858dac6d80.tar.gz tor-1ee41b3eef4b5e561c7c73e79885fe858dac6d80.zip |
Allow consensus interval of 10 seconds when testing
Decrease minimum consensus interval to 10 seconds
when TestingTorNetwork is set. (Or 5 seconds for
the first consensus.)
Fix code that assumes larger interval values.
This assists in quickly bootstrapping a testing
Tor network.
Fixes bugs 13718 & 13823.
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 12 |
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: */ |