diff options
author | rustdesk <[email protected]> | 2024-05-24 18:37:11 +0800 |
---|---|---|
committer | rustdesk <[email protected]> | 2024-05-24 18:37:11 +0800 |
commit | 5078a1f7971f4b5a507bd7164f1eb960e5195369 (patch) | |
tree | 4ec095d45c39892d1be5b0d21d3f9ce6d99e2b57 /src | |
parent | a22dacce0c9a0444bdffc5529d8645a599b07374 (diff) | |
download | rustdesk-server-5078a1f7971f4b5a507bd7164f1eb960e5195369.tar.gz rustdesk-server-5078a1f7971f4b5a507bd7164f1eb960e5195369.zip |
reuse port, and revert hbbr `-k`1.1.11-1
Diffstat (limited to 'src')
-rw-r--r-- | src/hbbr.rs | 2 | ||||
-rw-r--r-- | src/relay_server.rs | 2 | ||||
-rw-r--r-- | src/rendezvous_server.rs | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/hbbr.rs b/src/hbbr.rs index 49d449c..4c8a784 100644 --- a/src/hbbr.rs +++ b/src/hbbr.rs @@ -39,7 +39,7 @@ fn main() -> ResultType<()> { matches.value_of("port").unwrap_or(&port.to_string()), matches .value_of("key") - .unwrap_or(&std::env::var("KEY").unwrap_or("-".to_owned())), + .unwrap_or(&std::env::var("KEY").unwrap_or_default()), )?; Ok(()) } diff --git a/src/relay_server.rs b/src/relay_server.rs index e042c23..b55d544 100644 --- a/src/relay_server.rs +++ b/src/relay_server.rs @@ -85,7 +85,7 @@ pub async fn start(port: &str, key: &str) -> ResultType<()> { let main_task = async move { loop { log::info!("Start"); - io_loop(listen_any(port).await?, listen_any(port2).await?, &key).await; + io_loop(listen_any(port, true).await?, listen_any(port2, true).await?, &key).await; } }; let listen_signal = crate::common::listen_signal(); diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs index 0c0d107..bb99ee0 100644 --- a/src/rendezvous_server.rs +++ b/src/rendezvous_server.rs @@ -1294,19 +1294,19 @@ async fn send_rk_res( async fn create_udp_listener(port: i32, rmem: usize) -> ResultType<FramedSocket> { let addr = SocketAddr::new(IpAddr::V6(Ipv6Addr::UNSPECIFIED), port as _); - if let Ok(s) = FramedSocket::new_reuse(&addr, false, rmem).await { + if let Ok(s) = FramedSocket::new_reuse(&addr, true, rmem).await { log::debug!("listen on udp {:?}", s.local_addr()); return Ok(s); } let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), port as _); - let s = FramedSocket::new_reuse(&addr, false, rmem).await?; + let s = FramedSocket::new_reuse(&addr, true, rmem).await?; log::debug!("listen on udp {:?}", s.local_addr()); Ok(s) } #[inline] async fn create_tcp_listener(port: i32) -> ResultType<TcpListener> { - let s = listen_any(port as _).await?; + let s = listen_any(port as _, true).await?; log::debug!("listen on tcp {:?}", s.local_addr()); Ok(s) } |