mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
refine_session: actually delete greylist entries that fail the handshake
This commit is contained in:
@@ -268,7 +268,6 @@ impl GreylistRefinery {
|
||||
match hosts.container.fetch_random_with_schemes(HostColor::Grey, &allowed_transports) {
|
||||
Some((entry, _)) => {
|
||||
let url = &entry.0;
|
||||
let last_seen = &entry.1;
|
||||
|
||||
if let Err(e) = hosts.try_register(url.clone(), HostState::Refine) {
|
||||
debug!(target: "net::refinery", "Unable to refine addr={}, err={}",
|
||||
@@ -277,12 +276,15 @@ impl GreylistRefinery {
|
||||
}
|
||||
|
||||
if !self.session().handshake_node(url.clone(), self.p2p().clone()).await {
|
||||
hosts.container.remove_if_exists(HostColor::Grey, url);
|
||||
|
||||
debug!(
|
||||
target: "net::refinery",
|
||||
"Peer {} handshake failed. Removed from greylist", url,
|
||||
);
|
||||
|
||||
hosts.greylist_host(url, *last_seen).unwrap();
|
||||
// Free up this addr for future operations.
|
||||
hosts.unregister(url);
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user