Преглед изворни кода

Revert "net: these lines aren't needed. The enable/disable guard is simply for channel message logging. The other info is still accessible and adds no costs."

This reverts commit 977f3027ff722e095f6f59aca73a97125d1d2a12.
x пре 3 година
родитељ
комит
d8c9f893a1
1 измењених фајлова са 5 додато и 3 уклоњено
  1. 5 3
      src/net/p2p.rs

+ 5 - 3
src/net/p2p.rs

@@ -384,9 +384,11 @@ impl P2p {
     pub async fn dnet_info(&self) -> Vec<DnetInfo> {
         let mut ret = vec![];
 
-        ret.push(self.session_inbound().await.dnet_info().await);
-        ret.push(self.session_outbound().await.dnet_info().await);
-        ret.push(DnetInfo::Hosts(self.hosts.load_all().await));
+        if *self.dnet_enabled.lock().await {
+            ret.push(self.session_inbound().await.dnet_info().await);
+            ret.push(self.session_outbound().await.dnet_info().await);
+            ret.push(DnetInfo::Hosts(self.hosts.load_all().await));
+        }
 
         ret
     }