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,12 +63,8 @@ pub fn core_main() -> Option<Vec<String>> {
] ]
.contains(&arg.as_str()) .contains(&arg.as_str())
{ {
if config::is_incoming_only() {
return None;
} else {
_is_flutter_invoke_new_connection = true; _is_flutter_invoke_new_connection = true;
} }
}
if arg == "--elevate" { if arg == "--elevate" {
_is_elevate = true; _is_elevate = true;
} else if arg == "--run-as-system" { } else if arg == "--run-as-system" {