]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Possible fix for task #43: when running on a multithreaded environment (currently...
authorNick Mathewson <nickm@torproject.org>
Mon, 3 Jan 2005 18:06:51 +0000 (18:06 +0000)
committerNick Mathewson <nickm@torproject.org>
Mon, 3 Jan 2005 18:06:51 +0000 (18:06 +0000)
svn:r3247

src/common/compat.h
src/or/cpuworker.c
src/or/dns.c

index dafd1339a597d0ced8e61d9f368f75c5e91e9201..d9cb5669d64ed2ec7a310727ed67e562c22c7f67 100644 (file)
@@ -191,5 +191,11 @@ void tor_mutex_acquire(tor_mutex_t *m);
 void tor_mutex_release(tor_mutex_t *m);
 void tor_mutex_free(tor_mutex_t *m);
 
+#ifdef MS_WINDOWS
+#define TOR_IS_MULTITHREADED 1
+#else
+#undef TOR_IS_MULTITHREADED
+#endif
+
 #endif
 
index b1fef2660b511d5959000ad9e0bcac88d4663b15..c9ac3ebee44a9287f190c21fe76e457d8b7e3667 100644 (file)
@@ -210,7 +210,7 @@ static int cpuworker_main(void *data) {
   crypto_pk_env_t *onion_key = NULL, *last_onion_key = NULL;
 
   fd = fdarray[1]; /* this side is ours */
-#ifndef MS_WINDOWS
+#ifndef TOR_IS_MULTITHREADED
   tor_close_socket(fdarray[0]); /* this is the side of the socketpair the parent uses */
   connection_free_all(); /* so the child doesn't hold the parent's fd's open */
 #endif
@@ -282,7 +282,9 @@ static int spawn_cpuworker(void) {
 
   spawn_func(cpuworker_main, (void*)fd);
   log_fn(LOG_DEBUG,"just spawned a worker.");
+#ifndef TOR_IS_MULTITHREADED
   tor_close_socket(fd[1]); /* we don't need the worker's side of the pipe */
+#endif
 
   conn = connection_new(CONN_TYPE_CPUWORKER);
 
index 57871bf23fe924df306968897ee715405961a4cc..afc777dd7e365a4025c50def19e5c4490e442794 100644 (file)
@@ -654,7 +654,7 @@ static int dnsworker_main(void *data) {
   int result;
 
   fd = fdarray[1]; /* this side is ours */
-#ifndef MS_WINDOWS
+#ifndef TOR_IS_MULTITHREADED
   tor_close_socket(fdarray[0]); /* this is the side of the socketpair the parent uses */
   connection_free_all(); /* so the child doesn't hold the parent's fd's open */
 #endif
@@ -716,7 +716,9 @@ static int spawn_dnsworker(void) {
 
   spawn_func(dnsworker_main, (void*)fd);
   log_fn(LOG_DEBUG,"just spawned a worker.");
+#ifndef TOR_IS_MULTITHREADED
   tor_close_socket(fd[1]); /* we don't need the worker's side of the pipe */
+#endif
 
   conn = connection_new(CONN_TYPE_DNSWORKER);