diff options
author | rustdesk <[email protected]> | 2022-05-13 09:56:44 +0800 |
---|---|---|
committer | rustdesk <[email protected]> | 2022-05-13 09:56:44 +0800 |
commit | cb26ce5bbcf3edca54890cc9b82b48c971bacccb (patch) | |
tree | 8f7c36912df75c904dbba07b4238ccc090b95062 /src | |
parent | df2e4bb411cd0aa4b46a7cabcde1025b5058ce0f (diff) | |
download | rustdesk-server-cb26ce5bbcf3edca54890cc9b82b48c971bacccb.tar.gz rustdesk-server-cb26ce5bbcf3edca54890cc9b82b48c971bacccb.zip |
remove confusions
Diffstat (limited to 'src')
-rw-r--r-- | src/database.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 4 | ||||
-rw-r--r-- | src/rendezvous_server.rs | 17 |
3 files changed, 8 insertions, 17 deletions
diff --git a/src/database.rs b/src/database.rs index 5a199e6..cf64faf 100644 --- a/src/database.rs +++ b/src/database.rs @@ -55,11 +55,11 @@ impl Database { if !std::path::Path::new(url).exists() { std::fs::File::create(url).ok(); } - let n: usize = std::env::var("MAX_CONNECTIONS") + let n: usize = std::env::var("MAX_DATABASE_CONNECTIONS") .unwrap_or("1".to_owned()) .parse() .unwrap_or(1); - log::info!("MAX_CONNECTIONS={}", n); + log::debug!("MAX_DATABASE_CONNECTIONS={}", n); let pool = Pool::new( DbPool { url: url.to_owned(), diff --git a/src/main.rs b/src/main.rs index db2bbab..d715bd3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,6 @@ fn main() -> ResultType<()> { -R, --rendezvous-servers=[HOSTS] 'Sets rendezvous servers, seperated by colon' -u, --software-url=[URL] 'Sets download url of RustDesk software of newest version' -r, --relay-servers=[HOST] 'Sets the default relay servers, seperated by colon' - -C, --change-id=[BOOL(default=Y)] 'Sets if support to change id' -M, --rmem=[NUMBER(default={})] 'Sets UDP recv buffer size, set system rmem_max first, e.g., sudo sysctl -w net.core.rmem_max=52428800. vi /etc/sysctl.conf, net.core.rmem_max=52428800, sudo sysctl –p' -k, --key=[KEY] 'Only allow the client with the same key'", RENDEZVOUS_PORT, @@ -33,7 +32,6 @@ fn main() -> ResultType<()> { } let rmem = get_arg("rmem").parse::<usize>().unwrap_or(RMEM); let serial: i32 = get_arg("serial").parse().unwrap_or(0); - let id_change_support: bool = get_arg_or("change-id", "Y".to_owned()).to_uppercase() == "Y"; - RendezvousServer::start(port, serial, &get_arg("key"), id_change_support, rmem)?; + RendezvousServer::start(port, serial, &get_arg("key"), rmem)?; Ok(()) } diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs index 123eb98..37a4eb4 100644 --- a/src/rendezvous_server.rs +++ b/src/rendezvous_server.rs @@ -85,7 +85,6 @@ impl RendezvousServer { port: i32, serial: i32, key: &str, - id_change_support: bool, rmem: usize, ) -> ResultType<()> { let addr = format!("0.0.0.0:{}", port); @@ -97,7 +96,6 @@ impl RendezvousServer { log::info!("Listening on tcp/udp {}", addr); log::info!("Listening on tcp {}, extra port for NAT test", addr2); log::info!("Listening on websocket {}", addr3); - log::info!("change-id={:?}", id_change_support); let mut socket = FramedSocket::new_with_buf_size(&addr, rmem).await?; let (tx, mut rx) = mpsc::unbounded_channel::<Data>(); let software_url = get_arg("software-url"); @@ -163,7 +161,6 @@ impl RendezvousServer { &mut listener3, &mut socket, &key, - id_change_support, ) .await { @@ -195,7 +192,6 @@ impl RendezvousServer { listener3: &mut TcpListener, socket: &mut FramedSocket, key: &str, - id_change_support: bool, ) -> LoopFailure { let mut timer_check_relay = interval(Duration::from_millis(CHECK_RELAY_TIMEOUT)); loop { @@ -249,7 +245,7 @@ impl RendezvousServer { match res { Ok((stream, addr)) => { stream.set_nodelay(true).ok(); - self.handle_listener(stream, addr, key, id_change_support, true).await; + self.handle_listener(stream, addr, key, true).await; } Err(err) => { log::error!("listener3.accept failed: {}", err); @@ -261,7 +257,7 @@ impl RendezvousServer { match res { Ok((stream, addr)) => { stream.set_nodelay(true).ok(); - self.handle_listener(stream, addr, key, id_change_support, false).await; + self.handle_listener(stream, addr, key, false).await; } Err(err) => { log::error!("listener.accept failed: {}", err); @@ -446,7 +442,6 @@ impl RendezvousServer { sink: &mut Option<Sink>, addr: SocketAddr, key: &str, - id_change_support: bool, ws: bool, ) -> bool { if let Ok(msg_in) = RendezvousMessage::parse_from_bytes(&bytes) { @@ -1022,7 +1017,6 @@ impl RendezvousServer { stream: TcpStream, addr: SocketAddr, key: &str, - id_change_support: bool, ws: bool, ) { log::debug!("Tcp connection from {:?}, ws: {}", addr, ws); @@ -1030,7 +1024,7 @@ impl RendezvousServer { let key = key.to_owned(); tokio::spawn(async move { allow_err!( - rs.handle_listener_inner(stream, addr, &key, id_change_support, ws) + rs.handle_listener_inner(stream, addr, &key, ws) .await ); }); @@ -1042,7 +1036,6 @@ impl RendezvousServer { stream: TcpStream, addr: SocketAddr, key: &str, - id_change_support: bool, ws: bool, ) -> ResultType<()> { let mut sink; @@ -1054,7 +1047,7 @@ impl RendezvousServer { match msg { tungstenite::Message::Binary(bytes) => { if !self - .handle_tcp(&bytes, &mut sink, addr, key, id_change_support, ws) + .handle_tcp(&bytes, &mut sink, addr, key, ws) .await { break; @@ -1068,7 +1061,7 @@ impl RendezvousServer { sink = Some(Sink::TcpStream(a)); while let Ok(Some(Ok(bytes))) = timeout(30_000, b.next()).await { if !self - .handle_tcp(&bytes, &mut sink, addr, key, id_change_support, ws) + .handle_tcp(&bytes, &mut sink, addr, key, ws) .await { break; |