summaryrefslogtreecommitdiff
path: root/src/or/shared_random.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-10-27 09:16:29 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-10-27 09:23:37 -0400
commit7ee0a2b9aa71693a09687dca431cc1880774f4f4 (patch)
treecd6bb633dfcf0f7731671af751cf3b2044ed2123 /src/or/shared_random.c
parent60164f057c4ac5471754f0326ab631448cd7c120 (diff)
downloadtor-7ee0a2b9aa71693a09687dca431cc1880774f4f4.tar.gz
tor-7ee0a2b9aa71693a09687dca431cc1880774f4f4.zip
sr: Don't use a dynamic voting schedule
The exposed get_voting_schedule() allocates and return a new object everytime it is called leading to an awful lot of memory allocation when getting the start time of the current round which is done for each node in the consensus. Closes #23623 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/shared_random.c')
-rw-r--r--src/or/shared_random.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/or/shared_random.c b/src/or/shared_random.c
index bbb7af0a33..b3f62a8fd8 100644
--- a/src/or/shared_random.c
+++ b/src/or/shared_random.c
@@ -1333,13 +1333,7 @@ sr_act_post_consensus(const networkstatus_t *consensus)
}
/* 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);
- voting_schedule_free(voting_schedule);
- }
+ sr_state_update(dirvote_get_next_valid_after_time());
}
/* Initialize shared random subsystem. This MUST be called early in the boot