aboutsummaryrefslogtreecommitdiff
path: root/src/app/main/ntmain.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-01-06 08:45:29 -0500
committerNick Mathewson <nickm@torproject.org>2020-01-17 08:41:52 -0500
commitc8b6392b4e2edbaa188ea71594cb2f985149bd88 (patch)
treeb72ea9d1b2b76e793d7d329fae15765d595a85c2 /src/app/main/ntmain.c
parenteef021e12d5ad2fbc86d7bf058eacc40ae6f1757 (diff)
downloadtor-c8b6392b4e2edbaa188ea71594cb2f985149bd88.tar.gz
tor-c8b6392b4e2edbaa188ea71594cb2f985149bd88.zip
Initialize publish/subscribe code when running as an NT service.
Fixes bug 32778; bugfix on 0.4.1.1-alpha.
Diffstat (limited to 'src/app/main/ntmain.c')
-rw-r--r--src/app/main/ntmain.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/app/main/ntmain.c b/src/app/main/ntmain.c
index ced158e686..4941199759 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();