]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Actually disable NEED_NET periodic events when DisableNetwork is set
authorNick Mathewson <nickm@torproject.org>
Tue, 6 Nov 2018 12:40:02 +0000 (07:40 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 6 Nov 2018 12:40:02 +0000 (07:40 -0500)
Fixes bug 28348; bugfix on 0.3.4.1-alpha

changes/bug28348_034 [new file with mode: 0644]
src/or/main.c

diff --git a/changes/bug28348_034 b/changes/bug28348_034
new file mode 100644 (file)
index 0000000..3913c03
--- /dev/null
@@ -0,0 +1,5 @@
+  o Major bugfixes (embedding, main loop):
+    - When DisableNetwork becomes set, actually disable periodic events that
+      are already enabled. (Previously, we would refrain from enabling new
+      ones, but we would leave the old ones turned on.)
+      Fixes bug 28348; bugfix on 0.3.4.1-alpha.
index bc01e07c3d1ac883d2aa1a42bcc23bf72eabe4bf..184bf9e4e13234ab8ae583a832747d53cc9f560c 100644 (file)
@@ -1597,15 +1597,17 @@ rescan_periodic_events(const or_options_t *options)
   for (int i = 0; periodic_events[i].name; ++i) {
     periodic_event_item_t *item = &periodic_events[i];
 
+    int enable = !!(item->roles & roles);
+
     /* Handle the event flags. */
     if (net_is_disabled() &&
         (item->flags & PERIODIC_EVENT_FLAG_NEED_NET)) {
-      continue;
+      enable = 0;
     }
 
     /* Enable the event if needed. It is safe to enable an event that was
      * already enabled. Same goes for disabling it. */
-    if (item->roles & roles) {
+    if (enable) {
       log_debug(LD_GENERAL, "Launching periodic event %s", item->name);
       periodic_event_enable(item);
     } else {
@@ -4319,4 +4321,3 @@ tor_run_main(const tor_main_configuration_t *tor_cfg)
   tor_cleanup();
   return result;
 }
-