fix config sync

This commit is contained in:
rustdesk 2022-05-01 00:50:54 +08:00
parent f6612d39bf
commit 7235756603

View File

@ -353,9 +353,16 @@ async fn sync_and_watch_config_dir() {
match data { match data {
Data::SyncConfig(Some((config, config2))) => { Data::SyncConfig(Some((config, config2))) => {
let _chk = crate::ipc::CheckIfRestart::new(); let _chk = crate::ipc::CheckIfRestart::new();
if cfg0.0 != config {
cfg0.0 = config.clone();
Config::set(config); Config::set(config);
Config2::set(config2);
log::info!("sync config from root"); log::info!("sync config from root");
}
if cfg0.1 != config2 {
cfg0.1 = config2.clone();
Config2::set(config2);
log::info!("sync config2 from root");
}
synced = true; synced = true;
} }
_ => {} _ => {}
@ -369,7 +376,7 @@ async fn sync_and_watch_config_dir() {
let cfg = (Config::get(), Config2::get()); let cfg = (Config::get(), Config2::get());
if cfg != cfg0 { if cfg != cfg0 {
log::info!("config updated, sync to root"); log::info!("config updated, sync to root");
match conn.send(&Data::SyncConfig(Some(cfg0.clone()))).await { match conn.send(&Data::SyncConfig(Some(cfg.clone()))).await {
Err(e) => { Err(e) => {
log::error!("sync config to root failed: {}", e); log::error!("sync config to root failed: {}", e);
break; break;