Skip to content

Commit 72e02d5

Browse files
committed
req-resp: Fix memory leak of pending substreams
Signed-off-by: Alexandru Vasile <[email protected]>
1 parent 28d42c6 commit 72e02d5

File tree

1 file changed

+3
-0
lines changed
  • src/protocol/request_response

1 file changed

+3
-0
lines changed

src/protocol/request_response/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ impl RequestResponseProtocol {
292292
async fn on_connection_closed(&mut self, peer: PeerId) {
293293
tracing::debug!(target: LOG_TARGET, ?peer, protocol = %self.protocol, "connection closed");
294294

295+
// Remove any pending outbound substreams for this peer.
296+
self.pending_outbound.retain(|_, context| context.peer != peer);
297+
295298
let Some(context) = self.peers.remove(&peer) else {
296299
tracing::error!(
297300
target: LOG_TARGET,

0 commit comments

Comments
 (0)