print ping
This commit is contained in:
parent
fa40f2f932
commit
97b8129002
3 changed files with 4 additions and 7 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4,4 +4,4 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "qft"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "qft"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
|
@ -340,6 +340,7 @@ fn holepunch(args: &Vec<String>) -> UdpSocket {
|
|||
holepunch.send(&[0]).expect("connection failed");
|
||||
let result = holepunch.recv(&mut [0, 0]);
|
||||
if result.is_ok() && result.unwrap() == 1 {
|
||||
println!("Ping: {}", unix_millis() - m);
|
||||
holepunch.send(&[0, 0]).expect("connection failed");
|
||||
let result = holepunch.recv(&mut [0, 0]);
|
||||
if result.is_ok() && result.unwrap() == 2 {
|
||||
|
@ -347,11 +348,7 @@ fn holepunch(args: &Vec<String>) -> UdpSocket {
|
|||
}
|
||||
}
|
||||
}
|
||||
println!(
|
||||
"Holepunch and connection successful. Running with {} (partner) and :{} (you).",
|
||||
bind_addr,
|
||||
holepunch.local_addr().unwrap().port()
|
||||
);
|
||||
println!("Holepunch and connection successful.");
|
||||
return holepunch;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue