Просмотр исходного кода

net/outbound: put p2p.remove_pending() in the correct place.

x 2 лет назад
Родитель
Сommit
347f6da54e
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      src/net/session/outbound_session.rs

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

@@ -229,8 +229,6 @@ impl Slot {
                         err: err.to_string()
                     });
 
-                    self.p2p().remove_pending(&addr).await;
-
                     continue
                 }
             };
@@ -291,6 +289,9 @@ impl Slot {
                 // At this point we failed to connect. We'll quarantine this peer now.
                 self.p2p().hosts().quarantine(&addr).await;
 
+                // Remove connection from pending
+                self.p2p().remove_pending(&addr).await;
+
                 // Notify that channel processing failed
                 self.session().channel_subscriber.notify(Err(Error::ConnectFailed)).await;