mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-01 09:59:19 +08:00
Merge pull request #3629 from fufesou/refact/cm_start_ipc
cm, better position to start ipc
This commit is contained in:
commit
6d149f6ccb
@ -217,7 +217,6 @@ void runMultiWindow(
|
|||||||
|
|
||||||
void runConnectionManagerScreen(bool hide) async {
|
void runConnectionManagerScreen(bool hide) async {
|
||||||
await initEnv(kAppTypeConnectionManager);
|
await initEnv(kAppTypeConnectionManager);
|
||||||
await bind.cmStartListenIpcThread();
|
|
||||||
_runApp(
|
_runApp(
|
||||||
'',
|
'',
|
||||||
const DesktopServerPage(),
|
const DesktopServerPage(),
|
||||||
|
@ -234,6 +234,9 @@ class PlatformFFI {
|
|||||||
debugPrint(
|
debugPrint(
|
||||||
'_appType:$_appType,info1-id:$id,info2-name:$name,dir:$_dir');
|
'_appType:$_appType,info1-id:$id,info2-name:$name,dir:$_dir');
|
||||||
}
|
}
|
||||||
|
if (desktopType == DesktopType.cm) {
|
||||||
|
await _ffiBind.cmStartListenIpcThread();
|
||||||
|
}
|
||||||
await _ffiBind.mainDeviceId(id: id);
|
await _ffiBind.mainDeviceId(id: id);
|
||||||
await _ffiBind.mainDeviceName(name: name);
|
await _ffiBind.mainDeviceName(name: name);
|
||||||
await _ffiBind.mainSetHomeDir(home: _homeDir);
|
await _ffiBind.mainSetHomeDir(home: _homeDir);
|
||||||
|
@ -128,10 +128,13 @@ class ServerModel with ChangeNotifier {
|
|||||||
_connectStatus = status;
|
_connectStatus = status;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
final res = await bind.cmCheckClientsLength(length: _clients.length);
|
|
||||||
if (res != null) {
|
if (desktopType == DesktopType.cm) {
|
||||||
debugPrint("clients not match!");
|
final res = await bind.cmCheckClientsLength(length: _clients.length);
|
||||||
updateClientState(res);
|
if (res != null) {
|
||||||
|
debugPrint("clients not match!");
|
||||||
|
updateClientState(res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePasswordModel();
|
updatePasswordModel();
|
||||||
|
@ -2013,10 +2013,12 @@ async fn start_ipc(
|
|||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
{
|
{
|
||||||
|
log::debug!("Start cm");
|
||||||
res = crate::platform::run_as_user(args.clone());
|
res = crate::platform::run_as_user(args.clone());
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
|
log::debug!("Start cm");
|
||||||
res = crate::platform::run_as_user(args.clone(), None);
|
res = crate::platform::run_as_user(args.clone(), None);
|
||||||
}
|
}
|
||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
@ -2032,12 +2034,13 @@ async fn start_ipc(
|
|||||||
run_done = false;
|
run_done = false;
|
||||||
}
|
}
|
||||||
if !run_done {
|
if !run_done {
|
||||||
|
log::debug!("Start cm");
|
||||||
super::CHILD_PROCESS
|
super::CHILD_PROCESS
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.push(crate::run_me(args)?);
|
.push(crate::run_me(args)?);
|
||||||
}
|
}
|
||||||
for _ in 0..10 {
|
for _ in 0..20 {
|
||||||
sleep(0.3).await;
|
sleep(0.3).await;
|
||||||
if let Ok(s) = crate::ipc::connect(1000, "_cm").await {
|
if let Ok(s) = crate::ipc::connect(1000, "_cm").await {
|
||||||
stream = Some(s);
|
stream = Some(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user