summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-10-22 16:32:04 +0000
committerNick Mathewson <nickm@torproject.org>2007-10-22 16:32:04 +0000
commitc47eb2c8d95b57081b3f00fe90a1db9f3a10d4b0 (patch)
tree5c8322f93965b9417b5768403c0705f2a7b52f8d /src
parentdb058694663f1a0283a29fd11468619b0bf1de74 (diff)
downloadtor-c47eb2c8d95b57081b3f00fe90a1db9f3a10d4b0.tar.gz
tor-c47eb2c8d95b57081b3f00fe90a1db9f3a10d4b0.zip
r16032@catbus: nickm | 2007-10-22 11:56:53 -0400
When our directory status or our v3 authority status changes, reschedule operations as appropriate. (Fixes some xxxx020 items) svn:r12102
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c11
-rw-r--r--src/or/networkstatus.c3
-rw-r--r--src/or/or.h1
-rw-r--r--src/or/routerlist.c1
4 files changed, 13 insertions, 3 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 338f53875e..eb2f50bd0d 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1119,6 +1119,17 @@ options_act(or_options_t *old_options)
options_transition_affects_descriptor(old_options, options))
mark_my_descriptor_dirty();
+ /* We may need to reschedule some directory stuff if our status changed. */
+ if (authdir_mode_v3(options) && !authdir_mode_v3(old_options))
+ dirvote_recalculate_timing(options, time(NULL));
+ if (!bool_eq(dirserver_mode(options), dirserver_mode(old_options))) {
+ /* Make sure update_router_have_min_dir_info gets called. */
+ router_dir_info_changed();
+ /* We might need to download a new consensus status later or sooner than
+ * we had expected. */
+ update_consensus_networkstatus_fetch_time(time(NULL));
+ }
+
return 0;
}
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index aa70c2703b..589633c97c 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -776,11 +776,10 @@ networkstatus_consensus_download_failed(int status_code)
/** Update the time at which we'll consider replacing the current
* consensus. */
-static void
+void
update_consensus_networkstatus_fetch_time(time_t now)
{
or_options_t *options = get_options();
- /* XXXX020 call this when DirPort switches on or off. NMNM */
networkstatus_vote_t *c = networkstatus_get_live_consensus(now);
if (c) {
long dl_interval;
diff --git a/src/or/or.h b/src/or/or.h
index 53d1b6b24e..5e7d582ebc 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3103,6 +3103,7 @@ routerstatus_t *router_get_consensus_status_by_nickname(const char *nickname,
const char *networkstatus_get_router_digest_by_nickname(const char *nickname);
int networkstatus_nickname_is_unnamed(const char *nickname);
void networkstatus_consensus_download_failed(int status_code);
+void update_consensus_networkstatus_fetch_time(time_t now);
int should_delay_dir_fetches(or_options_t *options);
void update_networkstatus_downloads(time_t now);
networkstatus_v2_t *networkstatus_v2_get_by_digest(const char *digest);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 6aa0e58804..b62a48f041 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3863,7 +3863,6 @@ router_dir_info_changed(void)
static void
update_router_have_minimum_dir_info(void)
{
- /*XXX020 call when dirserver_mode() changes. */
int num_present = 0, num_usable=0;
time_t now = time(NULL);
int res;