[or-cvs] Possible fix for task #43: when running on a multithreaded ...

Nick Mathewson nickm at seul.org
Mon Jan 3 18:06:53 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv21346/src/or

Modified Files:
	cpuworker.c dns.c 
Log Message:
Possible fix for task #43: when running on a multithreaded environment (currently only windows), threads should not close opposite sides of their socketpairs, and workers should not call connection_free_all(). This may fix win32 servers.

Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/cpuworker.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- cpuworker.c	6 Dec 2004 23:19:55 -0000	1.61
+++ cpuworker.c	3 Jan 2005 18:06:51 -0000	1.62
@@ -210,7 +210,7 @@
   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 @@
 
   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: dns.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- dns.c	13 Dec 2004 00:44:38 -0000	1.126
+++ dns.c	3 Jan 2005 18:06:51 -0000	1.127
@@ -654,7 +654,7 @@
   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 @@
 
   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);
 



More information about the tor-commits mailing list