give up
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ pub fn handle_recevied_message(
|
||||
|
||||
let maybe_tx = {
|
||||
let mut map = pending.lock().expect("couldnt lock pending map");
|
||||
println!("trying to remove : {}", id);
|
||||
map.remove(&id)
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user