瀏覽代碼

manual_session: sleep when try_register() call fails, then try again

Fixes a bug that would cause a death loop when the call to
try_register() fails.

Also removes a duplicate WARN print.
draoi 2 年之前
父節點
當前提交
216794939d
共有 1 個文件被更改,包括 3 次插入6 次删除
  1. 3 6
      src/net/session/manual_session.rs

+ 3 - 6
src/net/session/manual_session.rs

@@ -179,6 +179,8 @@ impl Slot {
                 debug!(target: "net::manual_session",
                 debug!(target: "net::manual_session",
                     "Cannot connect to manual={}, err={}", &self.addr, e);
                     "Cannot connect to manual={}, err={}", &self.addr, e);
 
 
+                sleep(outbound_connect_timeout).await;
+
                 continue
                 continue
             }
             }
 
 
@@ -210,12 +212,6 @@ impl Slot {
                     }
                     }
                 }
                 }
                 Err(e) => {
                 Err(e) => {
-                    warn!(
-                        target: "net::manual_session",
-                        "[P2P] Unable to connect to manual outbound [{}]: {}",
-                        self.addr, e,
-                    );
-
                     self.handle_failure(e, &self.addr);
                     self.handle_failure(e, &self.addr);
                 }
                 }
             }
             }
@@ -225,6 +221,7 @@ impl Slot {
                 "[P2P] Waiting {} seconds until next manual outbound connection attempt [{}]",
                 "[P2P] Waiting {} seconds until next manual outbound connection attempt [{}]",
                 outbound_connect_timeout, self.addr,
                 outbound_connect_timeout, self.addr,
             );
             );
+
             sleep(outbound_connect_timeout).await;
             sleep(outbound_connect_timeout).await;
         }
         }
     }
     }