From 81e7cc4a1a0e1dda35bb1f80694f439d21ca90af Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 11 Dec 2023 09:54:04 +0100 Subject: [PATCH 1/2] Properly generate events when failing to negotiate ping --- lib/src/libp2p/connection/established/substream.rs | 7 +++++-- wasm-node/CHANGELOG.md | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/src/libp2p/connection/established/substream.rs b/lib/src/libp2p/connection/established/substream.rs index 5f3cb5a3e9..27ea009e62 100644 --- a/lib/src/libp2p/connection/established/substream.rs +++ b/lib/src/libp2p/connection/established/substream.rs @@ -1033,10 +1033,12 @@ where } Ok(multistream_select::Negotiation::Success) => {} Ok(multistream_select::Negotiation::NotAvailable) => { - return (Some(SubstreamInner::PingOutFailed { queued_pings }), None) + read_write.wake_up_asap(); + return (Some(SubstreamInner::PingOutFailed { queued_pings }), None); } Err(_) => { - return (Some(SubstreamInner::PingOutFailed { queued_pings }), None) + read_write.wake_up_asap(); + return (Some(SubstreamInner::PingOutFailed { queued_pings }), None); } } } @@ -1078,6 +1080,7 @@ where .pop_front() .map_or(true, |expected| pong != *expected) { + read_write.wake_up_asap(); return (Some(SubstreamInner::PingOutFailed { queued_pings }), None); } if queued_pings.remove(0).is_some() { diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index 0d32cc4a4d..c0c1a99783 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixed + +- Fix connection being properly killed when the ping substream fails to be negotiated. + ## 2.0.13 - 2023-11-28 ### Changed From 6370fba32a35a8782d7405e4657746ad35d20f78 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 11 Dec 2023 09:55:09 +0100 Subject: [PATCH 2/2] PR link --- wasm-node/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index c0c1a99783..89455e8669 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixed -- Fix connection being properly killed when the ping substream fails to be negotiated. +- Fix connection being properly killed when the ping substream fails to be negotiated. ([#1459](https://github.com/smol-dot/smoldot/pull/1459)) ## 2.0.13 - 2023-11-28