فهرست منبع

doc: improve net peer discovery info messages

Also rely on the seedsync to report failed seeding attempts.
draoi 1 سال پیش
والد
کامیت
fb7b7d50c4
3فایلهای تغییر یافته به همراه8 افزوده شده و 21 حذف شده
  1. 1 2
      src/net/p2p.rs
  2. 5 17
      src/net/session/outbound_session.rs
  3. 2 2
      src/net/session/seedsync_session.rs

+ 1 - 2
src/net/p2p.rs

@@ -144,14 +144,13 @@ impl P2p {
         // Start the refine session
         self.session_refine().start().await;
 
-        info!(target: "net::p2p::start", "[P2P] P2P subsystem started");
+        info!(target: "net::p2p::start", "[P2P] P2P subsystem started successfully");
         Ok(())
     }
 
     /// Reseed the P2P network.
     pub async fn seed(self: Arc<Self>) {
         debug!(target: "net::p2p::seed()", "P2P::seed() [BEGIN]");
-        info!(target: "net::p2p::seed()", "[P2P] Seeding P2P subsystem");
 
         // Activate the seed session.
         self.session_seedsync().notify().await;

+ 5 - 17
src/net/session/outbound_session.rs

@@ -541,7 +541,7 @@ impl PeerDiscoveryBase for PeerDiscovery {
                 debug!("current attempt: {}", current_attempt);
                 info!(
                     target: "net::outbound_session::peer_discovery()",
-                    "[P2P] Sleeping and trying again..."
+                    "[P2P] [PEER DISCOVERY] Sleeping and trying again..."
                 );
 
                 dnetev!(self, OutboundPeerDiscovery, {
@@ -559,12 +559,9 @@ impl PeerDiscoveryBase for PeerDiscovery {
             if self.p2p().is_connected() && current_attempt <= 2 {
                 // Broadcast the GetAddrs message to all active peers.
                 // If we have no active peers, we will perform a SeedSyncSession instead.
-
                 info!(
                     target: "net::outbound_session::peer_discovery()",
-                    "[P2P] Requesting addrs from active peers. Attempt: {}",
-                    current_attempt
-                );
+                    "[P2P] [PEER DISCOVERY] Asking peers for new peers to connect to...");
 
                 dnetev!(self, OutboundPeerDiscovery, {
                     attempt: current_attempt,
@@ -591,13 +588,13 @@ impl PeerDiscoveryBase for PeerDiscovery {
                     Ok(addrs_len) => {
                         info!(
                             target: "net::outbound_session::peer_discovery()",
-                            "[P2P] Discovered {} addrs", addrs_len
+                            "[P2P] [PEER DISCOVERY] Discovered {} peers", addrs_len
                         );
                     }
                     Err(_) => {
                         warn!(
                             target: "net::outbound_session::peer_discovery()",
-                            "[P2P] Peer discovery waiting for addrs timed out."
+                            "[P2P] [PEER DISCOVERY] Waiting for addrs timed out."
                         );
                         // Just do seed next time
                         current_attempt = 3;
@@ -612,9 +609,7 @@ impl PeerDiscoveryBase for PeerDiscovery {
             } else if !seeds.is_empty() {
                 info!(
                     target: "net::outbound_session::peer_discovery()",
-                    "[P2P] Seeding hosts. Attempt: {}",
-                    current_attempt
-                );
+                    "[P2P] [PEER DISCOVERY] Asking seeds for new peers to connect to...");
 
                 dnetev!(self, OutboundPeerDiscovery, {
                     attempt: current_attempt,
@@ -622,13 +617,6 @@ impl PeerDiscoveryBase for PeerDiscovery {
                 });
 
                 self.p2p().seed().await;
-
-                if self.p2p().session_seedsync().failed().await {
-                    error!(
-                        target: "net::outbound_session::peer_discovery()",
-                        "[P2P] Network reseed failed!"
-                    );
-                }
             }
 
             self.wakeup_self.reset();

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

@@ -129,7 +129,7 @@ impl SeedSyncSession {
     }
 
     /// Returns true if every seed attempt per slot has failed.
-    pub(crate) async fn failed(&self) -> bool {
+    async fn failed(&self) -> bool {
         let slots = &*self.slots.lock().await;
         slots.iter().all(|s| s.failed())
     }
@@ -277,7 +277,7 @@ impl Slot {
         self.reset();
     }
 
-    pub fn failed(&self) -> bool {
+    fn failed(&self) -> bool {
         self.failed.load(SeqCst)
     }