diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-12-21 15:42:57 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-12-21 15:42:57 -0500 |
commit | a9eec3364919a8e555631ef1654a016f1f00d59c (patch) | |
tree | 7cabba1c2233e11288dfbc749a040c10fe72dd7b /src | |
parent | 97c9ced70ac364f7067fc088b90184ab77c9ecd9 (diff) | |
parent | 2420e84ba4d4a35581eaa6bc41b08082002bfd4f (diff) | |
download | tor-a9eec3364919a8e555631ef1654a016f1f00d59c.tar.gz tor-a9eec3364919a8e555631ef1654a016f1f00d59c.zip |
Merge branch 'maint-0.3.4' into maint-0.3.5
Diffstat (limited to 'src')
-rw-r--r-- | src/core/mainloop/mainloop.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c index 7eff82fee4..413c149105 100644 --- a/src/core/mainloop/mainloop.c +++ b/src/core/mainloop/mainloop.c @@ -379,6 +379,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 @@ -395,10 +398,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. */ |