This commit is contained in:
Tiago Batista Cardoso
2026-01-22 00:30:17 +01:00
parent da29d67472
commit 5899a275a2
2 changed files with 4 additions and 3 deletions

View File

@@ -642,7 +642,7 @@ fn parse_pack(s: &str) -> Option<[u8; 6]> {
}
async fn quick_ping(addr: &SocketAddr, timeout_ms: u64, sd: &P2PSharedData) -> bool {
let id = generate_id();
let id = 42069;
let pingreq = construct_message(PING, Vec::new(), id, &sd.shared_cryptopair)
.expect("couldn't build ping message");
@@ -662,7 +662,7 @@ async fn quick_ping(addr: &SocketAddr, timeout_ms: u64, sd: &P2PSharedData) -> b
let mut pending = sd.pending.lock().expect("couldn't lock pending map");
pending.remove(&id);
matches!(res, Ok(Ok(_)))
matches!(res, Ok(Ok(_))) && !pending.contains_key(&id)
}
///
@@ -722,7 +722,7 @@ pub async fn get_socket_address(
for addr in addresses {
println!("trying address : {}", addr);
if quick_ping(&addr, 10000, sd).await {
if quick_ping(&addr, 20000, sd).await {
return Some(addr);
}