From 874c2cc85e8028d9351fd983d4423de2587e8574 Mon Sep 17 00:00:00 2001 From: draoi Date: Sun, 25 Feb 2024 13:50:17 +0100 Subject: [PATCH] net: only remove peer from hostlist after the configured quarantine limit --- src/net/hosts/store.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/net/hosts/store.rs b/src/net/hosts/store.rs index 49d009ea5..650a0c793 100644 --- a/src/net/hosts/store.rs +++ b/src/net/hosts/store.rs @@ -655,14 +655,13 @@ impl Hosts { /// If they've been quarantined for more than a configured limit, forget them. pub async fn quarantine(&self, url: &Url) { debug!(target: "store::remove()", "Quarantining peer {}", url); - // Remove from the entire hosts set - self.remove_host(url).await; - let mut q = self.quarantine.write().await; if let Some(retries) = q.get_mut(url) { *retries += 1; debug!(target: "net::hosts::quarantine()", "Peer {} quarantined {} times", url, retries); if *retries == self.settings.hosts_quarantine_limit { + debug!(target: "net::hosts::quarantine()", "Removing from hostlist {}", url); + self.remove_host(url).await; debug!(target: "net::hosts::quarantine()", "Banning peer {}", url); q.remove(url); self.mark_rejected(url).await;