aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main.rs
diff options
context:
space:
mode:
authoropen-trade <[email protected]>2021-03-19 16:38:10 +0800
committeropen-trade <[email protected]>2021-03-19 16:38:10 +0800
commitfc7f790defcf3b5db91d071ba4cf35c8cde3c6c0 (patch)
tree4cfc3aa3de9554769c93a75c357b58f79d2ba841 /src/main.rs
parent5f1259e1318df29fdb0efc9c338c0f614029873f (diff)
downloadrustdesk-server-fc7f790defcf3b5db91d071ba4cf35c8cde3c6c0.tar.gz
rustdesk-server-fc7f790defcf3b5db91d071ba4cf35c8cde3c6c0.zip
refactor
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index 9c64b71..8978a55 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,13 +2,12 @@
// https://blog.csdn.net/bytxl/article/details/44344855
use clap::App;
-use hbb_common::{env_logger::*, log, tokio, ResultType};
+use hbb_common::{env_logger::*, log, ResultType};
use hbbs::*;
use ini::Ini;
-const DEFAULT_PORT: &'static str = "21116";
+use std::sync::{Arc, Mutex};
-#[tokio::main]
-async fn main() -> ResultType<()> {
+fn main() -> ResultType<()> {
init_from_env(Env::default().filter_or(DEFAULT_FILTER_ENV, "info"));
let args = format!(
"-c --config=[FILE] +takes_value 'Sets a custom config file'
@@ -72,12 +71,11 @@ async fn main() -> ResultType<()> {
.map(|x| x.to_owned())
.collect();
let addr = format!("0.0.0.0:{}", port);
- log::info!("Listening on {}", addr);
let addr2 = format!("0.0.0.0:{}", port.parse::<i32>().unwrap_or(0) - 1);
- log::info!("Listening on {}, extra port for NAT test", addr2);
log::info!("relay-servers={:?}", relay_servers);
log::info!("serial={}", serial);
log::info!("rendezvous-servers={:?}", rendezvous_servers);
+ let stop: Arc<Mutex<bool>> = Default::default();
RendezvousServer::start(
&addr,
&addr2,
@@ -85,7 +83,7 @@ async fn main() -> ResultType<()> {
serial,
rendezvous_servers,
get_arg("software-url", ""),
- )
- .await?;
+ stop,
+ )?;
Ok(())
}