fix config::is_incoming_only

This commit is contained in:
rustdesk 2024-03-24 20:28:27 +08:00
parent ef27cd6c5c
commit 30af020ba8
2 changed files with 7 additions and 8 deletions

View File

@ -33,7 +33,7 @@ use hbb_common::{
anyhow::{anyhow, Context}, anyhow::{anyhow, Context},
bail, bail,
config::{ config::{
Config, LocalConfig, PeerConfig, PeerInfoSerde, Resolution, CONNECT_TIMEOUT, self, Config, LocalConfig, PeerConfig, PeerInfoSerde, Resolution, CONNECT_TIMEOUT,
PUBLIC_RS_PUB_KEY, READ_TIMEOUT, RELAY_PORT, RENDEZVOUS_PORT, RENDEZVOUS_SERVERS, PUBLIC_RS_PUB_KEY, READ_TIMEOUT, RELAY_PORT, RENDEZVOUS_PORT, RENDEZVOUS_SERVERS,
}, },
get_version_number, log, get_version_number, log,
@ -251,6 +251,9 @@ impl Client {
conn_type: ConnType, conn_type: ConnType,
interface: impl Interface, interface: impl Interface,
) -> ResultType<(Stream, bool, Option<Vec<u8>>)> { ) -> ResultType<(Stream, bool, Option<Vec<u8>>)> {
if config::is_incoming_only() {
bail!("Incoming only mode");
}
// to-do: remember the port for each peer, so that we can retry easier // to-do: remember the port for each peer, so that we can retry easier
if hbb_common::is_ip_str(peer) { if hbb_common::is_ip_str(peer) {
return Ok(( return Ok((

View File

@ -3,10 +3,10 @@ use crate::client::translate;
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::platform::breakdown_callback; use crate::platform::breakdown_callback;
use hbb_common::{config, log};
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
use hbb_common::platform::register_breakdown_handler; use hbb_common::platform::register_breakdown_handler;
use hbb_common::{config, log};
#[cfg(windows)] #[cfg(windows)]
use tauri_winrt_notification::{Duration, Sound, Toast}; use tauri_winrt_notification::{Duration, Sound, Toast};
@ -63,11 +63,7 @@ pub fn core_main() -> Option<Vec<String>> {
] ]
.contains(&arg.as_str()) .contains(&arg.as_str())
{ {
if config::is_incoming_only() { _is_flutter_invoke_new_connection = true;
return None;
} else {
_is_flutter_invoke_new_connection = true;
}
} }
if arg == "--elevate" { if arg == "--elevate" {
_is_elevate = true; _is_elevate = true;
@ -111,7 +107,7 @@ pub fn core_main() -> Option<Vec<String>> {
return core_main_invoke_new_connection(std::env::args()); return core_main_invoke_new_connection(std::env::args());
} }
let click_setup = cfg!(windows) && args.is_empty() && crate::common::is_setup(&arg_exe); let click_setup = cfg!(windows) && args.is_empty() && crate::common::is_setup(&arg_exe);
if click_setup && !config::is_disable_installation(){ if click_setup && !config::is_disable_installation() {
args.push("--install".to_owned()); args.push("--install".to_owned());
flutter_args.push("--install".to_string()); flutter_args.push("--install".to_string());
} }