aboutsummaryrefslogtreecommitdiff
path: root/src/app/main
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-04-25 14:20:41 -0400
committerNick Mathewson <nickm@torproject.org>2019-04-30 11:14:59 -0400
commit6eb1b8da0ab2a58157c4eb7db0a8471cb9dfefda (patch)
tree6b2f32d0d63040152eb8adf8e1a461de9ef1843f /src/app/main
parent0d650e7958d011dc165fbad7477e2eff842598ea (diff)
downloadtor-6eb1b8da0ab2a58157c4eb7db0a8471cb9dfefda.tar.gz
tor-6eb1b8da0ab2a58157c4eb7db0a8471cb9dfefda.zip
Turn 'mainloop' into a subsystem.
We need a little refactoring for this to work, since the initialization code for the periodic events assumes that libevent is already initialized, which it can't be until it's configured. This change, combined with the previous ones, lets other subsystems declare their own periodic events, without mainloop.c having to know about them. Implements ticket 30293.
Diffstat (limited to 'src/app/main')
-rw-r--r--src/app/main/shutdown.c2
-rw-r--r--src/app/main/subsystem_list.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/app/main/shutdown.c b/src/app/main/shutdown.c
index 314e33f228..2dc18e19a7 100644
--- a/src/app/main/shutdown.c
+++ b/src/app/main/shutdown.c
@@ -18,7 +18,6 @@
#include "app/main/shutdown.h"
#include "app/main/subsysmgr.h"
#include "core/mainloop/connection.h"
-#include "core/mainloop/mainloop.h"
#include "core/mainloop/mainloop_pubsub.h"
#include "core/or/channeltls.h"
#include "core/or/circuitlist.h"
@@ -176,7 +175,6 @@ tor_free_all(int postfork)
/* stuff in main.c */
tor_mainloop_disconnect_pubsub();
- tor_mainloop_free_all();
if (!postfork) {
release_lockfile();
diff --git a/src/app/main/subsystem_list.c b/src/app/main/subsystem_list.c
index 3834176182..7ffdcc8053 100644
--- a/src/app/main/subsystem_list.c
+++ b/src/app/main/subsystem_list.c
@@ -8,6 +8,7 @@
#include "lib/cc/compat_compiler.h"
#include "lib/cc/torint.h"
+#include "core/mainloop/mainloop_sys.h"
#include "core/or/ocirc_event_sys.h"
#include "core/or/orconn_event_sys.h"
#include "feature/control/btrack_sys.h"
@@ -44,6 +45,8 @@ const subsys_fns_t *tor_subsystems[] = {
&sys_orconn_event, /* -33 */
&sys_ocirc_event, /* -32 */
&sys_btrack, /* -30 */
+
+ &sys_mainloop, /* 5 */
};
const unsigned n_tor_subsystems = ARRAY_LENGTH(tor_subsystems);