node: Call service on failed connection attempt

Before this change, we were not calling back into the service due
to the missing `NodeId`.
This commit is contained in:
Alexis Sellier 2023-03-13 15:00:05 +01:00
parent 29b933e485
commit 94427ee22b
No known key found for this signature in database
1 changed files with 7 additions and 2 deletions

View File

@ -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);
}