From: Matt Corallo Date: Sun, 3 Oct 2021 21:44:52 +0000 (+0000) Subject: Wake reader future when we fail to flush socket buffer X-Git-Tag: v0.0.107~31^2~8 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=f90983180eac9950256d47cb5eb77353f19fec6b;p=rust-lightning Wake reader future when we fail to flush socket buffer This avoids any extra calls to `read_event` after a write fails to flush the write buffer fully, as is required by the PeerManager API (though it isn't critical). --- diff --git a/lightning-net-tokio/src/lib.rs b/lightning-net-tokio/src/lib.rs index cee7c5c1b..fc7b260e4 100644 --- a/lightning-net-tokio/src/lib.rs +++ b/lightning-net-tokio/src/lib.rs @@ -465,6 +465,9 @@ impl peer_handler::SocketDescriptor for SocketDescriptor { // pause read given we're now waiting on the remote end to ACK (and in // accordance with the send_data() docs). us.read_paused = true; + // Further, to avoid any current pending read causing a `read_event` call, wake + // up the read_waker and restart its loop. + let _ = us.read_waker.try_send(()); return written_len; }, }