diff --git a/flutter/lib/main.dart b/flutter/lib/main.dart index bb1b4f552..f0a9a938f 100644 --- a/flutter/lib/main.dart +++ b/flutter/lib/main.dart @@ -217,7 +217,6 @@ void runMultiWindow( void runConnectionManagerScreen(bool hide) async { await initEnv(kAppTypeConnectionManager); - await bind.cmStartListenIpcThread(); _runApp( '', const DesktopServerPage(), diff --git a/flutter/lib/models/native_model.dart b/flutter/lib/models/native_model.dart index 28dc8085e..2b99e1823 100644 --- a/flutter/lib/models/native_model.dart +++ b/flutter/lib/models/native_model.dart @@ -234,6 +234,9 @@ class PlatformFFI { debugPrint( '_appType:$_appType,info1-id:$id,info2-name:$name,dir:$_dir'); } + if (desktopType == DesktopType.cm) { + await _ffiBind.cmStartListenIpcThread(); + } await _ffiBind.mainDeviceId(id: id); await _ffiBind.mainDeviceName(name: name); await _ffiBind.mainSetHomeDir(home: _homeDir); diff --git a/flutter/lib/models/server_model.dart b/flutter/lib/models/server_model.dart index 846f20ed4..216814cf6 100644 --- a/flutter/lib/models/server_model.dart +++ b/flutter/lib/models/server_model.dart @@ -128,10 +128,13 @@ class ServerModel with ChangeNotifier { _connectStatus = status; notifyListeners(); } - final res = await bind.cmCheckClientsLength(length: _clients.length); - if (res != null) { - debugPrint("clients not match!"); - updateClientState(res); + + if (desktopType == DesktopType.cm) { + final res = await bind.cmCheckClientsLength(length: _clients.length); + if (res != null) { + debugPrint("clients not match!"); + updateClientState(res); + } } updatePasswordModel(); diff --git a/src/server/connection.rs b/src/server/connection.rs index 7127187d8..7899009c4 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -2013,10 +2013,12 @@ async fn start_ipc( for _ in 0..10 { #[cfg(not(target_os = "linux"))] { + log::debug!("Start cm"); res = crate::platform::run_as_user(args.clone()); } #[cfg(target_os = "linux")] { + log::debug!("Start cm"); res = crate::platform::run_as_user(args.clone(), None); } if res.is_ok() { @@ -2032,12 +2034,13 @@ async fn start_ipc( run_done = false; } if !run_done { + log::debug!("Start cm"); super::CHILD_PROCESS .lock() .unwrap() .push(crate::run_me(args)?); } - for _ in 0..10 { + for _ in 0..20 { sleep(0.3).await; if let Ok(s) = crate::ipc::connect(1000, "_cm").await { stream = Some(s);