diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-11-07 14:01:10 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-11-07 14:01:10 -0500 |
commit | 6d6cd2060f375cbd96b448c0bed67169c309cd65 (patch) | |
tree | 1206374404e224a7870f86877a08a9a02618de7e | |
parent | 0c8eebd90c5e745bb60339bea6fee79f19d0d6fd (diff) | |
parent | c58471325a48f8181d32d45ef75cd23ffd942181 (diff) | |
download | tor-6d6cd2060f375cbd96b448c0bed67169c309cd65.tar.gz tor-6d6cd2060f375cbd96b448c0bed67169c309cd65.zip |
Merge branch 'maint-0.3.2' into release-0.3.2
-rw-r--r-- | src/or/dirvote.c | 7 | ||||
-rw-r--r-- | src/or/networkstatus.c | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c index c5ceefecb4..33e5ea7d51 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -2859,6 +2859,13 @@ static voting_schedule_t voting_schedule; time_t dirvote_get_next_valid_after_time(void) { + /* This is a safe guard in order to make sure that the voting schedule + * static object is at least initialized. Using this function with a zeroed + * voting schedule can lead to bugs. */ + if (tor_mem_is_zero((const char *) &voting_schedule, + sizeof(voting_schedule))) { + dirvote_recalculate_timing(get_options(), time(NULL)); + } return voting_schedule.interval_starts; } diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 93bb8643d8..2660e6a329 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1939,13 +1939,17 @@ networkstatus_set_current_consensus(const char *consensus, } if (is_usable_flavor) { + /* The "current" consensus has just been set and it is a usable flavor so + * the first thing we need to do is recalculate the voting schedule static + * object so we can use the timings in there needed by some subsystems + * such as hidden service and shared random. */ + dirvote_recalculate_timing(options, now); + nodelist_set_consensus(c); /* XXXXNM Microdescs: needs a non-ns variant. ???? NM*/ update_consensus_networkstatus_fetch_time(now); - dirvote_recalculate_timing(options, now); - /* Update ewma and adjust policy if needed; first cache the old value */ old_ewma_enabled = cell_ewma_enabled(); /* Change the cell EWMA settings */ |