From ed91add604c4023cf297999938a9b46aa09c03cb Mon Sep 17 00:00:00 2001 From: BHouwens Date: Tue, 21 May 2024 13:27:42 +0200 Subject: [PATCH 1/2] Provide rails for handling handshake failure past peer limit --- src/comms_handler/node.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/comms_handler/node.rs b/src/comms_handler/node.rs index 2a3cafdd..66658425 100644 --- a/src/comms_handler/node.rs +++ b/src/comms_handler/node.rs @@ -1059,7 +1059,16 @@ impl Node { peer.peer_type = Some(peer_type); if let Some(notify) = peer.notify_handshake_response.0.take() { - notify.send(()).unwrap(); + match notify.send(()) { + Ok(()) => {} + Err(_) => { + return Err(CommsError::PeerInvalidState(PeerInfo { + node_type: Some(peer_type), + address: Some(peer_addr), + })); + } + + } } } From 14145f3f4a1dab9b59da4084208cdb7784723d94 Mon Sep 17 00:00:00 2001 From: BHouwens Date: Tue, 21 May 2024 13:27:54 +0200 Subject: [PATCH 2/2] Cargo fmt --- src/comms_handler/node.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/comms_handler/node.rs b/src/comms_handler/node.rs index 66658425..a07dddcc 100644 --- a/src/comms_handler/node.rs +++ b/src/comms_handler/node.rs @@ -1067,7 +1067,6 @@ impl Node { address: Some(peer_addr), })); } - } } }