tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 99713b176b3713c3960be7b2852ffdb301daa916
parent 70dd6d07bbd7c233e9f39e24b27775eae77f2363
Author: Nick Mathewson <nickm@torproject.org>
Date:   Fri, 21 Dec 2018 15:42:58 -0500

Merge branch 'maint-0.3.5'

Diffstat:
Achanges/ticket28912 | 6++++++
Msrc/core/mainloop/mainloop.c | 17++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/changes/ticket28912 b/changes/ticket28912 @@ -0,0 +1,6 @@ + o Major bugfixes (relay, directory): + - A connection serving directory information wouldn't get reactivated after + the first chunk of data was sent (usually 32KB). Tor now always activate + the main loop event that goes through these connections as long as at + least one connection is still active. Fixes bug 28912; bugfix on + 0.3.4.1-alpha. Patch by "cypherpunks3". diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c @@ -377,6 +377,9 @@ connection_unlink(connection_t *conn) connection_free(conn); } +/** Event that invokes schedule_active_linked_connections_cb. */ +static mainloop_event_t *schedule_active_linked_connections_event = NULL; + /** * Callback: used to activate read events for all linked connections, so * libevent knows to call their read callbacks. This callback run as a @@ -393,10 +396,18 @@ schedule_active_linked_connections_cb(mainloop_event_t *event, void *arg) * so that libevent knows to run their callbacks. */ SMARTLIST_FOREACH(active_linked_connection_lst, connection_t *, conn, event_active(conn->read_event, EV_READ, 1)); -} -/** Event that invokes schedule_active_linked_connections_cb. */ -static mainloop_event_t *schedule_active_linked_connections_event = NULL; + /* Reactivate the event if we still have connections in the active list. + * + * A linked connection doesn't get woken up by I/O but rather artificially + * by this event callback. It has directory data spooled in it and it is + * sent incrementally by small chunks unless spool_eagerly is true. For that + * to happen, we need to induce the activation of the read event so it can + * be flushed. */ + if (smartlist_len(active_linked_connection_lst)) { + mainloop_event_activate(schedule_active_linked_connections_event); + } +} /** Initialize the global connection list, closeable connection list, * and active connection list. */