summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-11-06 07:40:02 -0500
committerNick Mathewson <nickm@torproject.org>2018-11-06 07:40:02 -0500
commit2aff02eb3dee506424874bd6d9c1ded3860abc22 (patch)
treeeaa1273efdbfe4bd505a85b5758d9271e09d2fbe
parent5acf6f8717d3dcaf170e4e1b07f688f0bfbc2ac7 (diff)
downloadtor-2aff02eb3dee506424874bd6d9c1ded3860abc22.tar.gz
tor-2aff02eb3dee506424874bd6d9c1ded3860abc22.zip
Actually disable NEED_NET periodic events when DisableNetwork is set
Fixes bug 28348; bugfix on 0.3.4.1-alpha
-rw-r--r--changes/bug28348_0345
-rw-r--r--src/or/main.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/changes/bug28348_034 b/changes/bug28348_034
new file mode 100644
index 0000000000..3913c03a4c
--- /dev/null
+++ b/changes/bug28348_034
@@ -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.
diff --git a/src/or/main.c b/src/or/main.c
index bc01e07c3d..184bf9e4e1 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -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;
}
-