Răsfoiți Sursa

store: fix death loop

if we don't remove the greylist entry, keeps trying to connect to
it
lunar-mining 2 ani în urmă
părinte
comite
ad3675eb3c
1 a modificat fișierele cu 5 adăugiri și 1 ștergeri
  1. 5 1
      src/net/hosts/store.rs

+ 5 - 1
src/net/hosts/store.rs

@@ -454,6 +454,7 @@ impl Hosts {
             let (index, entry) = self.get_anchorlist_entry_at_addr(addr).await?;
             let (index, entry) = self.get_anchorlist_entry_at_addr(addr).await?;
             self.anchorlist_remove(addr, index).await;
             self.anchorlist_remove(addr, index).await;
             self.greylist_store_or_update(&[entry]).await?;
             self.greylist_store_or_update(&[entry]).await?;
+
             Ok(())
             Ok(())
         } else if self.whitelist_contains(addr).await {
         } else if self.whitelist_contains(addr).await {
             debug!(target: "net::store::downgrade_host()", 
             debug!(target: "net::store::downgrade_host()", 
@@ -461,11 +462,14 @@ impl Hosts {
             let (index, entry) = self.get_whitelist_entry_at_addr(addr).await?;
             let (index, entry) = self.get_whitelist_entry_at_addr(addr).await?;
             self.whitelist_remove(addr, index).await;
             self.whitelist_remove(addr, index).await;
             self.greylist_store_or_update(&[entry]).await?;
             self.greylist_store_or_update(&[entry]).await?;
+
             Ok(())
             Ok(())
         } else {
         } else {
             debug!(target: "net::store::downgrade_host()", 
             debug!(target: "net::store::downgrade_host()", 
                    "Greylist entry detected! Do nothing for now...");
                    "Greylist entry detected! Do nothing for now...");
-            // TODO
+            let index = self.get_greylist_index_at_addr(addr).await?;
+            self.greylist_remove(addr, index).await;
+
             Ok(())
             Ok(())
         }
         }
     }
     }