Don't attempt to log messages to a controller from a worker thread.

This patch adds a function to determine whether we're in the main
thread, and changes control_event_logmsg() to return immediately if
we're in a subthread.  This is necessary because otherwise we will
call connection_write_to_buf, which modifies non-locked data
structures.

Bugfix on 0.2.0.x; fix for at least one of the things currently
called "bug 977".
This commit is contained in:
Nick Mathewson
2009-05-29 10:18:50 -04:00
parent d66c379765
commit fd992deeea
5 changed files with 32 additions and 0 deletions
+2
View File
@@ -2480,6 +2480,8 @@ start_daemon(void)
if (fork() != 0) {
exit(0);
}
set_main_thread(); /* We are now the main thread. */
return;
}
}