From 5aa187913f3eb32ab36227a17bc33763972390e6 Mon Sep 17 00:00:00 2001 From: draoi Date: Sat, 27 Jan 2024 14:05:43 +0100 Subject: [PATCH] refinery: bugfix start the channel BEFORE calling .await on the handshake task. otherwise the channel does not exist yet and the handshake will timeout. --- src/net/hosts/refinery.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/hosts/refinery.rs b/src/net/hosts/refinery.rs index e3f5d61d8..f1525a58d 100644 --- a/src/net/hosts/refinery.rs +++ b/src/net/hosts/refinery.rs @@ -174,13 +174,13 @@ async fn ping_node_impl(addr: Url, p2p: P2pPtr) -> bool { p2p.executor(), ); + channel.clone().start(p2p.executor()); + // Ensure the channel gets stopped by adding a timeout to the handshake. Otherwise if // the handshake does not finish channel.stop() will never get called, resulting in // zombie processes. let result = timeout(Duration::from_secs(5), handshake_task).await; - channel.clone().start(p2p.executor()); - match result { Ok(_) => { debug!(target: "net::refinery::ping_node()", "Handshake success! Stopping channel.");