aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/relay_server.rs
diff options
context:
space:
mode:
authordlhxzb <[email protected]>2022-08-04 18:02:10 +0900
committerdlhxzb <[email protected]>2022-08-04 18:02:10 +0900
commitca2bc99a38794aa401bfa39eece84b7eec3b8b25 (patch)
tree2b851f569e528868a01cd3d6215a0fd3a7871778 /src/relay_server.rs
parent848b5aedb7e8bda0f582706c792ffbab2d657a39 (diff)
downloadrustdesk-server-ca2bc99a38794aa401bfa39eece84b7eec3b8b25.tar.gz
rustdesk-server-ca2bc99a38794aa401bfa39eece84b7eec3b8b25.zip
Feat: listen for unix signal
Diffstat (limited to 'src/relay_server.rs')
-rw-r--r--src/relay_server.rs25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/relay_server.rs b/src/relay_server.rs
index 7b198d6..be8a69d 100644
--- a/src/relay_server.rs
+++ b/src/relay_server.rs
@@ -81,15 +81,22 @@ pub async fn start(port: &str, key: &str) -> ResultType<()> {
log::info!("Listening on tcp {}", addr);
let addr2 = format!("0.0.0.0:{}", port.parse::<u16>().unwrap() + 2);
log::info!("Listening on websocket {}", addr2);
- loop {
- log::info!("Start");
- io_loop(
- new_listener(&addr, false).await?,
- new_listener(&addr2, false).await?,
- &key,
- )
- .await;
- }
+ let main_task = async move {
+ loop {
+ log::info!("Start");
+ io_loop(
+ new_listener(&addr, false).await?,
+ new_listener(&addr2, false).await?,
+ &key,
+ )
+ .await;
+ }
+ };
+ let listen_signal = crate::common::listen_signal();
+ tokio::select!(
+ res = main_task => res,
+ res = listen_signal => res,
+ )
}
fn check_params() {