[tor-commits] [tor/master] Initialize publish/subscribe code when running as an NT service.

2020-01-19 Thread teor
commit c8b6392b4e2edbaa188ea71594cb2f985149bd88
Author: Nick Mathewson 
Date:   Mon Jan 6 08:45:29 2020 -0500

Initialize publish/subscribe code when running as an NT service.

Fixes bug 32778; bugfix on 0.4.1.1-alpha.
---
 changes/bug32778  | 3 +++
 src/app/main/main.c   | 4 ++--
 src/app/main/main.h   | 3 +++
 src/app/main/ntmain.c | 7 +++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/changes/bug32778 b/changes/bug32778
new file mode 100644
index 0..ccb610469
--- /dev/null
+++ b/changes/bug32778
@@ -0,0 +1,3 @@
+  o Minor bugfixes (windows service):
+- Initialize publish/subscribe system when running as a windows service.
+  Fixes bug 32778; bugfix on 0.4.1.1-alpha.
diff --git a/src/app/main/main.c b/src/app/main/main.c
index dad977726..689bc526a 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -1191,7 +1191,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();
@@ -1203,7 +1203,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 209d419f0..e6ed978c6 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 ced158e68..494119975 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();



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Initialize publish/subscribe code when running as an NT service.

2020-01-15 Thread teor
commit 54eec5342d45e9add5b9a8fee0167267c38f63f9
Author: Nick Mathewson 
Date:   Mon Jan 6 08:45:29 2020 -0500

Initialize publish/subscribe code when running as an NT service.

Fixes bug 32778; bugfix on 0.4.1.1-alpha.
---
 changes/bug32778  | 3 +++
 src/app/main/main.c   | 4 ++--
 src/app/main/main.h   | 3 +++
 src/app/main/ntmain.c | 7 +++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/changes/bug32778 b/changes/bug32778
new file mode 100644
index 0..ccb610469
--- /dev/null
+++ b/changes/bug32778
@@ -0,0 +1,3 @@
+  o Minor bugfixes (windows service):
+- Initialize publish/subscribe system when running as a windows service.
+  Fixes bug 32778; bugfix on 0.4.1.1-alpha.
diff --git a/src/app/main/main.c b/src/app/main/main.c
index 6e325f0b1..f3772f86e 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -1236,7 +1236,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();
@@ -1248,7 +1248,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 9dfaf4b8e..76574a907 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 f00b71270..c5a812203 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();



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits