From 38c22ba95b1405bc60d8fac906a758d6f3f7026f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20CORTIER?= Date: Wed, 23 Apr 2025 01:20:06 +0900 Subject: [PATCH] fix(jetsocat,dgw): EOFed peer causing writer to be closed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The writer was incorrenctly closed when the peer sent th EOF message. Even if the peer is EOFed, it’s still possible to send data to it. --- crates/jmux-proxy/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/jmux-proxy/src/lib.rs b/crates/jmux-proxy/src/lib.rs index c1d11de8d..ad30749a9 100644 --- a/crates/jmux-proxy/src/lib.rs +++ b/crates/jmux-proxy/src/lib.rs @@ -393,6 +393,9 @@ async fn scheduler_task_impl(task: JmuxSc Some(internal_msg) = internal_msg_rx.recv() => { match internal_msg { InternalMessage::Eof { id } => { + // Remove associated data sender. + data_senders.remove(&id); + let channel = jmux_ctx.get_channel_mut(id).with_context(|| format!("couldn’t find channel with id {id}"))?; let channel_span = channel.span.clone(); let local_id = channel.local_id; @@ -667,9 +670,6 @@ async fn scheduler_task_impl(task: JmuxSc debug!("Distant peer EOFed"); }); - // Remove associated data sender - data_senders.remove(&id); - match channel.local_state { JmuxChannelState::Streaming => {}, JmuxChannelState::Eof => {