diff --git a/core/dtn7/src/cla/httppull.rs b/core/dtn7/src/cla/httppull.rs index 7fff1bac..18f5e7f9 100644 --- a/core/dtn7/src/cla/httppull.rs +++ b/core/dtn7/src/cla/httppull.rs @@ -2,7 +2,6 @@ use std::collections::HashMap; use std::convert::TryFrom; use crate::core::helpers::get_complete_digest; -use crate::core::peer::PeerAddress; use crate::{store_has_item, CONFIG}; use super::TransferResult; @@ -44,7 +43,7 @@ async fn http_pull_from_node( return TransferResult::Failure; } }; - if digest == local_digest { + if digest == local_digest || digest.len() != 40 { debug!("no new bundles on remote"); return TransferResult::Successful; } else { @@ -122,25 +121,23 @@ async fn http_pull_bundles() { let peers = crate::PEERS.lock().clone(); for (_, p) in peers.iter() { - if let PeerAddress::Ip(ipaddr) = p.addr { - let peer = p.clone(); - let local_digest = local_digest.clone(); - let mut port = 3000; - for cla in p.cla_list.iter() { - if cla.0 == "httppull" { - if let Some(p) = cla.1 { - port = p; - break; - } + let peer = p.clone(); + let local_digest = local_digest.clone(); + let mut port = 3000; + for cla in p.cla_list.iter() { + if cla.0 == "httppull" { + if let Some(p) = cla.1 { + port = p; + break; } } - if CONFIG.lock().parallel_bundle_processing { - tokio::spawn(async move { - http_pull_from_node(peer.eid, ipaddr.to_string(), port, local_digest).await; - }); - } else { - http_pull_from_node(peer.eid, ipaddr.to_string(), port, local_digest).await; - } + } + if CONFIG.lock().parallel_bundle_processing { + tokio::spawn(async move { + http_pull_from_node(peer.eid, peer.addr.to_string(), port, local_digest).await; + }); + } else { + http_pull_from_node(peer.eid, peer.addr.to_string(), port, local_digest).await; } } debug!("finished pulling bundles from peers");