Merge remote-tracking branch 'asn/bug19555'

This commit is contained in:
Nick Mathewson 2016-07-05 12:17:21 -04:00
commit e11cc95717
2 changed files with 14 additions and 5 deletions

View File

@ -1293,7 +1293,6 @@ sr_get_string_for_consensus(const smartlist_t *votes,
void
sr_act_post_consensus(const networkstatus_t *consensus)
{
time_t interval_starts;
const or_options_t *options = get_options();
/* Don't act if our state hasn't been initialized. We can be called during
@ -1323,10 +1322,14 @@ sr_act_post_consensus(const networkstatus_t *consensus)
sr_state_set_current_srv(srv_dup(consensus->sr_info.current_srv));
}
/* Update our internal state with the next voting interval starting time. */
interval_starts = get_voting_schedule(options, time(NULL),
LOG_NOTICE)->interval_starts;
/* Prepare our state so that it's ready for the next voting period. */
{
voting_schedule_t *voting_schedule =
get_voting_schedule(options,time(NULL), LOG_NOTICE);
time_t interval_starts = voting_schedule->interval_starts;
sr_state_update(interval_starts);
tor_free(voting_schedule);
}
}
/* Initialize shared random subsystem. This MUST be called early in the boot

View File

@ -597,10 +597,16 @@ disk_state_put_srv_line(const sr_srv_t *srv, config_line_t *line)
static void
disk_state_reset(void)
{
/* Free allocated memory */
config_free_lines(sr_disk_state->Commit);
config_free_lines(sr_disk_state->SharedRandValues);
config_free_lines(sr_disk_state->ExtraLines);
tor_free(sr_disk_state->TorVersion);
/* Clean up the struct */
memset(sr_disk_state, 0, sizeof(*sr_disk_state));
/* Reset it with useful data */
sr_disk_state->magic_ = SR_DISK_STATE_MAGIC;
sr_disk_state->TorVersion = tor_strdup(get_version());
}