summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-04-17 18:55:28 -0400
committerDavid Goulet <dgoulet@torproject.org>2018-04-23 10:57:28 -0400
commitf70fa67da6d22d7351bd8f50db0804c239ffa5d6 (patch)
treeb4582904cfebb9894774e97da557d1fa52c62c4e /src/or/main.c
parent4e85f17eec06fc963c33cc3f637876e7f1627a57 (diff)
downloadtor-f70fa67da6d22d7351bd8f50db0804c239ffa5d6.tar.gz
tor-f70fa67da6d22d7351bd8f50db0804c239ffa5d6.zip
main: Use rescan_periodic_events in initialize_periodic_events_cb
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 1c5ac198b0..565131cb32 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -150,6 +150,7 @@ static int run_main_loop_until_done(void);
static void process_signal(int sig);
static void shutdown_did_not_work_callback(evutil_socket_t fd, short event,
void *arg) ATTR_NORETURN;
+static void rescan_periodic_events(const or_options_t *options);
/********* START VARIABLES **********/
@@ -1478,18 +1479,9 @@ initialize_periodic_events_cb(evutil_socket_t fd, short events, void *data)
(void) events;
(void) data;
- int roles = get_my_roles(get_options());
-
tor_event_free(initialize_periodic_events_event);
- for (int i = 0; periodic_events[i].name; ++i) {
- periodic_event_item_t *item = &periodic_events[i];
- if (item->roles & roles) {
- /* This is safe to be called on an already enabled event. */
- periodic_event_enable(item);
- log_debug(LD_GENERAL, "Launching periodic event %s", item->name);
- }
- }
+ rescan_periodic_events(get_options());
}
/** Set up all the members of periodic_events[], and configure them all to be
@@ -1546,8 +1538,10 @@ rescan_periodic_events(const or_options_t *options)
/* 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) {
+ log_debug(LD_GENERAL, "Launching periodic event %s", item->name);
periodic_event_enable(item);
} else {
+ log_debug(LD_GENERAL, "Disabling periodic event %s", item->name);
periodic_event_disable(item);
}
}