Skip to content

Commit

Permalink
feat: support work over proxy HTTP/HTTPS/SOCKS with DNS name instead …
Browse files Browse the repository at this point in the history
…of IP address (#52) (#63)
  • Loading branch information
iwojim0 committed Mar 14, 2024
1 parent 94d7890 commit e7f7fb6
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions core/dtn7/src/cla/httppull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit e7f7fb6

Please sign in to comment.