mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
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:
@@ -3367,6 +3367,11 @@ control_event_logmsg(int severity, uint32_t domain, const char *msg)
|
||||
{
|
||||
int event;
|
||||
|
||||
/* Don't even think of trying to add stuff to a buffer from a cpuworker
|
||||
* thread. */
|
||||
if (! in_main_thread())
|
||||
return;
|
||||
|
||||
if (disable_log_messages)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user