diff options
author | David Goulet <dgoulet@torproject.org> | 2019-10-15 13:33:48 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-10-17 10:11:32 -0400 |
commit | 4a8d4913227ea1d6b9302cda4703516595a3c1b5 (patch) | |
tree | b6ae62ca1951850e958143fad95ad8fd1f158bc5 /src | |
parent | 7b9cb4c47bc9d1ca4e120af2b00a0f0747cd7b20 (diff) | |
download | tor-4a8d4913227ea1d6b9302cda4703516595a3c1b5.tar.gz tor-4a8d4913227ea1d6b9302cda4703516595a3c1b5.zip |
mainloop: Disable periodic events before a destroy
When tearing down all periodic events during shutdown, disable them first so
their enable flag is updated.
This allows the tor_api.h to relaunch tor properly after a clean shutdown.
Fixes #32058
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/mainloop/periodic.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/mainloop/periodic.c b/src/core/mainloop/periodic.c index 34690c54d9..2651bbbc89 100644 --- a/src/core/mainloop/periodic.c +++ b/src/core/mainloop/periodic.c @@ -137,6 +137,11 @@ periodic_event_destroy(periodic_event_item_t *event) { if (!event) return; + + /* First disable the event so we first cancel the event and set its enabled + * flag properly. */ + periodic_event_disable(event); + mainloop_event_free(event->ev); event->last_action_time = 0; } |