diff --git a/src/protocol/request_response/mod.rs b/src/protocol/request_response/mod.rs index 38e631a1..3a64a386 100644 --- a/src/protocol/request_response/mod.rs +++ b/src/protocol/request_response/mod.rs @@ -292,6 +292,9 @@ impl RequestResponseProtocol { async fn on_connection_closed(&mut self, peer: PeerId) { tracing::debug!(target: LOG_TARGET, ?peer, protocol = %self.protocol, "connection closed"); + // Remove any pending outbound substreams for this peer. + self.pending_outbound.retain(|_, context| context.peer != peer); + let Some(context) = self.peers.remove(&peer) else { tracing::error!( target: LOG_TARGET,