diff options
author | rustdesk <[email protected]> | 2023-06-08 13:42:34 +0800 |
---|---|---|
committer | rustdesk <[email protected]> | 2023-06-08 13:42:34 +0800 |
commit | 3a7904fa8e325636a85b4cc941b3d598c9651a7f (patch) | |
tree | 6ce9c49300ee1080e9175f8b908de658293cb09b /src | |
parent | 482d7fb8ccaf671170f5a8fa93af2d91b27d583f (diff) | |
download | rustdesk-server-3a7904fa8e325636a85b4cc941b3d598c9651a7f.tar.gz rustdesk-server-3a7904fa8e325636a85b4cc941b3d598c9651a7f.zip |
fix test_hbb and bump version 1.1.8
Diffstat (limited to 'src')
-rw-r--r-- | src/rendezvous_server.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs index 88cd6cb..681ffe6 100644 --- a/src/rendezvous_server.rs +++ b/src/rendezvous_server.rs @@ -1,7 +1,7 @@ use crate::common::*; use crate::peer::*; use hbb_common::{ - allow_err, + allow_err, bail, bytes::{Bytes, BytesMut}, bytes_codec::BytesCodec, config, @@ -166,7 +166,10 @@ impl RendezvousServer { test_addr.parse()? }; tokio::spawn(async move { - allow_err!(test_hbbs(test_addr).await); + if let Err(err) = test_hbbs(test_addr).await { + log::error!("Failed to run hbbs test with {test_addr}: {err}"); + std::process::exit(1); + } }); }; let main_task = async move { @@ -1225,6 +1228,15 @@ async fn check_relay_servers(rs0: Arc<RelayServers>, tx: Sender) { // temp solution to solve udp socket failure async fn test_hbbs(addr: SocketAddr) -> ResultType<()> { + let mut addr = addr; + if addr.ip().is_unspecified() { + addr.set_ip(if addr.is_ipv4() { + IpAddr::V4(Ipv4Addr::LOCALHOST) + } else { + IpAddr::V6(Ipv6Addr::LOCALHOST) + }); + } + let mut socket = FramedSocket::new(config::Config::get_any_listen_addr(addr.is_ipv4())).await?; let mut msg_out = RendezvousMessage::new(); msg_out.set_register_peer(RegisterPeer { @@ -1238,8 +1250,7 @@ async fn test_hbbs(addr: SocketAddr) -> ResultType<()> { tokio::select! { _ = timer.tick() => { if last_time_recv.elapsed().as_secs() > 12 { - log::error!("Timeout of test_hbbs"); - std::process::exit(1); + bail!("Timeout of test_hbbs"); } socket.send(&msg_out, addr).await?; } |