aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2020-01-30 07:55:12 +1000
committerteor <teor@torproject.org>2020-01-30 07:55:12 +1000
commit7b6be02a923075ec3966d967cca26eb8d16b645e (patch)
tree6c01bb787616622b4bf02ed21e8e4391e6ace905 /src/app
parent48187248d3f79243590d60285708f3e2d45f8d8f (diff)
parent6b392c333a854bb4d18ae6ea1686627451bb03f8 (diff)
downloadtor-7b6be02a923075ec3966d967cca26eb8d16b645e.tar.gz
tor-7b6be02a923075ec3966d967cca26eb8d16b645e.zip
Merge branch 'maint-0.4.1' into maint-0.4.2
Diffstat (limited to 'src/app')
-rw-r--r--src/app/main/main.c4
-rw-r--r--src/app/main/main.h3
-rw-r--r--src/app/main/ntmain.c7
3 files changed, 12 insertions, 2 deletions
diff --git a/src/app/main/main.c b/src/app/main/main.c
index 3bdf8f146b..1901479eba 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -1237,7 +1237,7 @@ run_tor_main_loop(void)
}
/** Install the publish/subscribe relationships for all the subsystems. */
-static void
+void
pubsub_install(void)
{
pubsub_builder_t *builder = pubsub_builder_new();
@@ -1249,7 +1249,7 @@ pubsub_install(void)
/** Connect the mainloop to its publish/subscribe message delivery events if
* appropriate, and configure the global channels appropriately. */
-static void
+void
pubsub_connect(void)
{
if (get_options()->command == CMD_RUN_TOR) {
diff --git a/src/app/main/main.h b/src/app/main/main.h
index 9dfaf4b8ef..76574a9071 100644
--- a/src/app/main/main.h
+++ b/src/app/main/main.h
@@ -25,4 +25,7 @@ int tor_init(int argc, char **argv);
int run_tor_main_loop(void);
+void pubsub_install(void);
+void pubsub_connect(void);
+
#endif /* !defined(TOR_MAIN_H) */
diff --git a/src/app/main/ntmain.c b/src/app/main/ntmain.c
index a2de5bb87e..de82eeb1de 100644
--- a/src/app/main/ntmain.c
+++ b/src/app/main/ntmain.c
@@ -283,7 +283,9 @@ nt_service_body(int argc, char **argv)
return;
}
+ pubsub_install();
r = tor_init(backup_argc, backup_argv);
+
if (r) {
/* Failed to start the Tor service */
r = NT_SERVICE_ERROR_TORINIT_FAILED;
@@ -294,6 +296,8 @@ nt_service_body(int argc, char **argv)
return;
}
+ pubsub_connect();
+
/* Set the service's status to SERVICE_RUNNING and start the main
* event loop */
service_status.dwCurrentState = SERVICE_RUNNING;
@@ -322,9 +326,12 @@ nt_service_main(void)
errmsg = format_win32_error(result);
printf("Service error %d : %s\n", (int) result, errmsg);
tor_free(errmsg);
+
+ pubsub_install();
if (result == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
if (tor_init(backup_argc, backup_argv))
return;
+ pubsub_connect();
switch (get_options()->command) {
case CMD_RUN_TOR:
run_tor_main_loop();