diff options
author | Roger Dingledine <arma@torproject.org> | 2007-12-06 17:01:16 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-12-06 17:01:16 +0000 |
commit | 75c38a2c88eb4d34d2fe8e5137aaa6cd6a8d8f3b (patch) | |
tree | 57e0e5c77d4f25912f619c1ed2a75158d84e5f22 /src/or/networkstatus.c | |
parent | b277954501a3884932c5efb1be5e1e7b23954d13 (diff) | |
download | tor-75c38a2c88eb4d34d2fe8e5137aaa6cd6a8d8f3b.tar.gz tor-75c38a2c88eb4d34d2fe8e5137aaa6cd6a8d8f3b.zip |
Bridges now behave like clients with respect to time intervals for
downloading new consensus documents. Bridge users now wait until
the end of the interval, so their bridge will be sure to have a
new consensus document.
svn:r12696
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 54a9da4c23..605c8d5f76 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1058,12 +1058,21 @@ update_consensus_networkstatus_fetch_time(time_t now) /* But only in the first half-interval after that. */ dl_interval = interval/2; } else { - /* Give all the caches enough time to download the consensus.*/ + /* We're an ordinary client or a bridge. Give all the caches enough + * time to download the consensus. */ start = c->fresh_until + (interval*3)/4; - /* But download the next one before this one is expired. */ + /* But download the next one well before this one is expired. */ dl_interval = ((c->valid_until - start) * 7 )/ 8; - /* XXX020 do something different if - * directory_fetches_dir_info_like_bridge_user() */ + + /* If we're a bridge user, make use of the numbers we just computed + * to choose the rest of the interval *after* them. */ + if (directory_fetches_dir_info_like_bridge_user(options)) { + /* Give all the *clients* enough time to download the consensus. */ + start = start + dl_interval + CONSENSUS_MIN_SECONDS_BEFORE_CACHING; + /* But try to get it before ours actually expires. */ + dl_interval = (c->valid_until - start) - + CONSENSUS_MIN_SECONDS_BEFORE_CACHING; + } } if (dl_interval < 1) dl_interval = 1; |