[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/release-0.4.0] mainloop: Disable periodic events before a destroy



commit 4a8d4913227ea1d6b9302cda4703516595a3c1b5
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date:   Tue Oct 15 13:33:48 2019 -0400

    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@xxxxxxxxxxxxxx>
---
 changes/ticket32058          | 5 +++++
 src/core/mainloop/periodic.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/changes/ticket32058 b/changes/ticket32058
new file mode 100644
index 000000000..b40bcda41
--- /dev/null
+++ b/changes/ticket32058
@@ -0,0 +1,5 @@
+  o Minor bugfixes (mainloop, periodic events):
+    - Periodic events enabled flag was not unset properly when shutting down tor
+      cleanly. This had the side effect to not re-enable periodic events when
+      tor_api.h is used to relaunch tor after a shutdown. Fixes bug 32058;
+      bugfix on 0.3.3.1-alpha.
diff --git a/src/core/mainloop/periodic.c b/src/core/mainloop/periodic.c
index 34690c54d..2651bbbc8 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;
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits