瀏覽代碼

session/mod: use !p2p.connected() instead of channels().is_empty()

draoi 2 年之前
父節點
當前提交
e2ba275cb9
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/net/session/mod.rs

+ 1 - 1
src/net/session/mod.rs

@@ -85,7 +85,7 @@ pub async fn remove_sub_on_stop(p2p: P2pPtr, channel: ChannelPtr, type_id: Sessi
     // Remove channel from the HostRegistry. Free up this addr for any future operation.
     // Remove channel from the HostRegistry. Free up this addr for any future operation.
     hosts.unregister(channel.address());
     hosts.unregister(channel.address());
 
 
-    if hosts.channels().is_empty() {
+    if !p2p.is_connected() {
         hosts.disconnect_publisher.notify(Error::NetworkNotConnected).await;
         hosts.disconnect_publisher.notify(Error::NetworkNotConnected).await;
     }
     }
     debug!(target: "net::session::remove_sub_on_stop()", "[END]");
     debug!(target: "net::session::remove_sub_on_stop()", "[END]");