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 => {