Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support work over proxy HTTP/HTTPS/SOCKS #63

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -121,25 +120,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
Loading