aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-12-06 17:01:16 +0000
committerRoger Dingledine <arma@torproject.org>2007-12-06 17:01:16 +0000
commit75c38a2c88eb4d34d2fe8e5137aaa6cd6a8d8f3b (patch)
tree57e0e5c77d4f25912f619c1ed2a75158d84e5f22 /src
parentb277954501a3884932c5efb1be5e1e7b23954d13 (diff)
downloadtor-75c38a2c88eb4d34d2fe8e5137aaa6cd6a8d8f3b.tar
tor-75c38a2c88eb4d34d2fe8e5137aaa6cd6a8d8f3b.tar.gz
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')
-rw-r--r--src/or/dirserv.c3
-rw-r--r--src/or/networkstatus.c17
2 files changed, 16 insertions, 4 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index f36ac55b6..e0d4d05a1 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1096,8 +1096,11 @@ dirserv_dump_directory_to_string(char **dir_out,
int
directory_fetches_from_authorities(or_options_t *options)
{
+ /* XXX if options->FetchDirInfoEagerly, return 1 */
if (options->DirPort == 0)
return 0;
+ if (options->BridgeRelay == 1)
+ return 0;
/* XXX if dirport not advertised, return 0 too */
if (!server_mode(options))
return 0;
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 54a9da4c2..605c8d5f7 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;