Browse Source

dht: seeds to me ignored during syncing

aggstam 4 năm trước cách đây
mục cha
commit
aa39dc272b
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 7 1
      src/dht/dht.rs

+ 7 - 1
src/dht/dht.rs

@@ -221,7 +221,7 @@ impl Dht {
     /// Auxilary function to sync lookup map with network
     /// Auxilary function to sync lookup map with network
     pub async fn sync_lookup_map(&mut self) -> Result<()> {
     pub async fn sync_lookup_map(&mut self) -> Result<()> {
         debug!("Starting lookup map sync...");
         debug!("Starting lookup map sync...");
-
+        let seeds = self.p2p.settings().seeds.clone();
         let channels_map = self.p2p.channels().lock().await.clone();
         let channels_map = self.p2p.channels().lock().await.clone();
         let values = channels_map.values();
         let values = channels_map.values();
         // Using len here because is_empty() uses unstable library feature
         // Using len here because is_empty() uses unstable library feature
@@ -229,6 +229,12 @@ impl Dht {
         if values.len() != 0 {
         if values.len() != 0 {
             // Node iterates the channel peers to ask for their lookup map
             // Node iterates the channel peers to ask for their lookup map
             for channel in values {
             for channel in values {
+                // Filtering seed channel, as they don't have registered protocols
+                if seeds.contains(&channel.address()) {
+                    debug!("Seed channel, continuing..");
+                    continue
+                }
+
                 // Communication setup
                 // Communication setup
                 let msg_subsystem = channel.get_message_subsystem();
                 let msg_subsystem = channel.get_message_subsystem();
                 msg_subsystem.add_dispatch::<LookupMapResponse>().await;
                 msg_subsystem.add_dispatch::<LookupMapResponse>().await;