outbound_session: suspend a peer that fails the version exchange

This commit is contained in:
draoi
2024-05-22 15:06:57 +02:00
parent 444a2b3e14
commit 511c26c904
2 changed files with 11 additions and 1 deletions

View File

@@ -228,7 +228,7 @@ impl HostState {
match self {
HostState::Insert => Err(Error::HostStateBlocked(start, end)),
HostState::Refine => Err(Error::HostStateBlocked(start, end)),
HostState::Connect => Err(Error::HostStateBlocked(start, end)),
HostState::Connect => Ok(HostState::Suspend),
HostState::Suspend => Err(Error::HostStateBlocked(start, end)),
HostState::Connected(_) => Err(Error::HostStateBlocked(start, end)),
HostState::Move => Ok(HostState::Suspend),

View File

@@ -420,6 +420,16 @@ impl Slot {
});
self.channel_id.store(0, Ordering::Relaxed);
warn!(
target: "net::outbound_session::try_connect()",
"[P2P] Suspending addr= [{}] slot #{}",
addr, slot
);
// Mark its state as Suspend, which sends this node to the Refinery for processing.
self.p2p().hosts().try_register(addr.clone(), HostState::Suspend).await.unwrap();
continue
}