From 7eb1ab119db8128bf5ae4e41d72407402b02d4ac Mon Sep 17 00:00:00 2001 From: Tiago Batista Cardoso Date: Thu, 22 Jan 2026 00:14:26 +0100 Subject: [PATCH] wip --- client-network/src/lib.rs | 18 +++++++----------- client-network/src/message_handling.rs | 5 ----- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/client-network/src/lib.rs b/client-network/src/lib.rs index 5908363..880afa7 100644 --- a/client-network/src/lib.rs +++ b/client-network/src/lib.rs @@ -531,13 +531,9 @@ async fn quick_ping(addr: &SocketAddr, timeout_ms: u64, sd: &P2PSharedData) -> b let mut pending = sd.pending.lock().expect("couldnt lock pending map"); pending.insert(id, tx); } - if let Err(e) = sd.socket().send_to(&pingreq, addr) { - // remove pending on send failure - let mut pending = sd.pending.lock().expect("couldnt lock pending map"); - pending.remove(&id); - eprintln!("send_to failed: {}", e); - return false; - } + + sd.senders_ref() + .send_dispatch(pingreq, addr.to_string(), false, sd.messages_list()); let dur = Duration::from_millis(timeout_ms); let res = timeout(dur, rx).await; @@ -606,7 +602,7 @@ pub async fn get_socket_address( for addr in addresses { println!("trying address : {}", addr); - if quick_ping(&addr, 1000, sd).await { + if quick_ping(&addr, 10000, sd).await { return Some(addr); } @@ -632,9 +628,9 @@ pub async fn get_socket_address( // sd.messages_list().clone(), //); - if quick_ping(&addr, 1500, sd).await { - return Some(addr); - } + //if quick_ping(&addr, 1500, sd).await { + // return Some(addr); + //} } None diff --git a/client-network/src/message_handling.rs b/client-network/src/message_handling.rs index 9480c41..4636efe 100644 --- a/client-network/src/message_handling.rs +++ b/client-network/src/message_handling.rs @@ -77,11 +77,6 @@ pub fn handle_recevied_message( map.remove(&id) }; - if let Some(tx) = maybe_tx { - let _ = tx.send(Vec::new()); // ignore send error if receiver dropped - return; - } - let mut is_resp_to_server_handshake = false; if recevied_message[4] == HELLO {