Selaa lähdekoodia

outbound_session: fetch_address() logic bug fix

we need to use else if rather than chaining if statements as it gets
confused and calls multiple fetch methods otherwise.
lunar-mining 2 vuotta sitten
vanhempi
sitoutus
e472003b6d
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      src/net/session/outbound_session.rs

+ 2 - 2
src/net/session/outbound_session.rs

@@ -210,7 +210,7 @@ impl Slot {
         //  Select from the whitelist
         //  Select from the whitelist
         //  If the whitelist is empty, select from the greylist
         //  If the whitelist is empty, select from the greylist
         //  If the greylist is empty, do peer discovery
         //  If the greylist is empty, do peer discovery
-        if connect_count < white_count {
+        else if connect_count < white_count {
             debug!(target: "outbound_session::fetch_address()",
             debug!(target: "outbound_session::fetch_address()",
             "Next N connections- prefer white connections");
             "Next N connections- prefer white connections");
             return hosts.whitelist_fetch_address_with_lock(self.p2p(), transports).await
             return hosts.whitelist_fetch_address_with_lock(self.p2p(), transports).await
@@ -219,7 +219,7 @@ impl Slot {
         //
         //
         //  Select from the greylist
         //  Select from the greylist
         //  If the greylist is empty, do peer discovery
         //  If the greylist is empty, do peer discovery
-        if connect_count < slot_count {
+        else if connect_count < slot_count {
             debug!(target: "outbound_session::fetch_address()",
             debug!(target: "outbound_session::fetch_address()",
             "All other connections- get grey connections");
             "All other connections- get grey connections");
             return hosts.greylist_fetch_address_with_lock(self.p2p(), transports).await
             return hosts.greylist_fetch_address_with_lock(self.p2p(), transports).await