From 53dbc2fa6f1b46a11adad7d2a2ce52013041c837 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sun, 7 Jul 2024 09:25:27 +0800 Subject: [PATCH] add OPTION_DISABLE_UDP --- libs/hbb_common/src/config.rs | 2 ++ src/rendezvous_mediator.rs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 0778a487d..d1cac6395 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -2099,6 +2099,7 @@ pub mod keys { pub const OPTION_ENABLE_DIRECTX_CAPTURE: &str = "enable-directx-capture"; pub const OPTION_ENABLE_ANDROID_SOFTWARE_ENCODING_HALF_SCALE: &str = "enable-android-software-encoding-half-scale"; + pub const OPTION_DISABLE_UDP: &str = "disable-udp"; // flutter local options pub const OPTION_FLUTTER_REMOTE_MENUBAR_STATE: &str = "remoteMenubarState"; @@ -2231,6 +2232,7 @@ pub mod keys { OPTION_PRESET_ADDRESS_BOOK_TAG, OPTION_ENABLE_DIRECTX_CAPTURE, OPTION_ENABLE_ANDROID_SOFTWARE_ENCODING_HALF_SCALE, + OPTION_DISABLE_UDP, ]; } diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs index a27f95315..ceb4057c7 100644 --- a/src/rendezvous_mediator.rs +++ b/src/rendezvous_mediator.rs @@ -392,7 +392,10 @@ impl RendezvousMediator { } else { false }; - if (cfg!(debug_assertions) && option_env!("TEST_TCP").is_some()) || is_http_proxy { + if (cfg!(debug_assertions) && option_env!("TEST_TCP").is_some()) + || is_http_proxy + || Config::get_option(config::keys::OPTION_DISABLE_UDP) == "Y" + { Self::start_tcp(server, host).await } else { Self::start_udp(server, host).await