mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
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.
svn:r3247
This commit is contained in:
parent
c173c47249
commit
ead52e0bdc
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user