diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-05-03 11:59:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-05-03 11:59:31 -0400 |
commit | ed636de4cc71fb2936358da27f211fb6a255cd9d (patch) | |
tree | a67eddd76c29cd20ad73540c62bbdfcd24be87a5 /src/or/control.c | |
parent | be9f0e5f20e37d2176ce0663b71b532c44c10c28 (diff) | |
parent | 77b7eb2795208ad5c5f66a5626a89b14b03de6f2 (diff) | |
download | tor-ed636de4cc71fb2936358da27f211fb6a255cd9d.tar.gz tor-ed636de4cc71fb2936358da27f211fb6a255cd9d.zip |
Merge remote-tracking branch 'github/ticket25951'
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/or/control.c b/src/or/control.c index bc7597707f..4557d467b9 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -803,6 +803,9 @@ queued_event_free_(queued_event_t *ev) static void queued_events_flush_all(int force) { + /* Make sure that we get all the pending log events, if there are any. */ + flush_pending_log_callbacks(); + if (PREDICT_UNLIKELY(queued_control_events == NULL)) { return; } @@ -6186,7 +6189,7 @@ 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. */ + * thread. (See #25987 for plan to fix.) */ if (! in_main_thread()) return; @@ -6232,6 +6235,23 @@ control_event_logmsg(int severity, uint32_t domain, const char *msg) } } +/** + * Logging callback: called when there is a queued pending log callback. + */ +void +control_event_logmsg_pending(void) +{ + if (! in_main_thread()) { + /* We can't handle this case yet, since we're using a + * mainloop_event_t to invoke queued_events_flush_all. We ought to + * use a different mechanism instead: see #25987. + **/ + return; + } + tor_assert(flush_queued_events_event); + mainloop_event_activate(flush_queued_events_event); +} + /** Called whenever we receive new router descriptors: tell any * interested control connections. <b>routers</b> is a list of * routerinfo_t's. |