From 94427ee22ba796cde7b065975545e9439b13d3d4 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Mon, 13 Mar 2023 15:00:05 +0100 Subject: [PATCH] node: Call service on failed connection attempt Before this change, we were not calling back into the service due to the missing `NodeId`. --- radicle-node/src/wire/protocol.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/radicle-node/src/wire/protocol.rs b/radicle-node/src/wire/protocol.rs index 1afd211f..72bf910c 100644 --- a/radicle-node/src/wire/protocol.rs +++ b/radicle-node/src/wire/protocol.rs @@ -121,11 +121,14 @@ impl Peer { /// Return the peer's id, if any. fn id(&self) -> Option<&NodeId> { match self { - Peer::Connected { id, .. } + Peer::Outbound { id } + | Peer::Connected { id, .. } | Peer::Disconnected { id: Some(id), .. } | Peer::Upgrading { id, .. } | Peer::Upgraded { id, .. } => Some(id), - _ => None, + + Peer::Inbound {} => None, + Peer::Disconnected { id: None, .. } => None, } } @@ -592,6 +595,8 @@ where if let Some(id) = peer.id() { self.service.disconnected(*id, &reason); + } else { + log::debug!(target: "wire", "Inbound disconnection before handshake; ignoring..") } peer.disconnected(reason); }