aboutsummaryrefslogtreecommitdiff
path: root/src/app/main
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-03-11 16:02:38 -0400
committerNick Mathewson <nickm@torproject.org>2019-03-25 16:35:33 -0400
commit6d1abd37e27761bc3c92c398dbc03711fcf9e5c8 (patch)
tree732941c8e57850a01c6c026e45b430b8317c462e /src/app/main
parent02e0a39d396ad4f86d27770a5cf6f46553a01b0c (diff)
downloadtor-6d1abd37e27761bc3c92c398dbc03711fcf9e5c8.tar.gz
tor-6d1abd37e27761bc3c92c398dbc03711fcf9e5c8.zip
Connect the mainloop pubsub dispatcher on startup; free it on shutdown.
Diffstat (limited to 'src/app/main')
-rw-r--r--src/app/main/main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/app/main/main.c b/src/app/main/main.c
index ba2dfebd77..7bf9d3fe2b 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -19,6 +19,7 @@
#include "core/mainloop/connection.h"
#include "core/mainloop/cpuworker.h"
#include "core/mainloop/mainloop.h"
+#include "core/mainloop/mainloop_pubsub.h"
#include "core/mainloop/netstatus.h"
#include "core/or/channel.h"
#include "core/or/channelpadding.h"
@@ -75,6 +76,7 @@
#include "lib/net/resolve.h"
#include "lib/process/waitpid.h"
+#include "lib/pubsub/pubsub_build.h"
#include "lib/meminfo/meminfo.h"
#include "lib/osinfo/uname.h"
@@ -807,6 +809,7 @@ tor_free_all(int postfork)
}
/* stuff in main.c */
+ tor_mainloop_disconnect_pubsub();
tor_mainloop_free_all();
if (!postfork) {
@@ -1407,6 +1410,15 @@ tor_run_main(const tor_main_configuration_t *tor_cfg)
}
}
#endif /* defined(NT_SERVICE) */
+
+ {
+ pubsub_builder_t *builder = pubsub_builder_new();
+ int r = subsystems_add_pubsub(builder);
+ tor_assert(r == 0);
+ r = tor_mainloop_connect_pubsub(builder); // consumes builder
+ tor_assert(r == 0);
+ }
+
{
int init_rv = tor_init(argc, argv);
if (init_rv) {