Merge pull request #5344 from 21pages/fix

remove not save peer config when version is zero
This commit is contained in:
RustDesk 2023-08-11 08:41:13 +08:00 committed by GitHub
commit ea12eccc90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View File

@ -1151,10 +1151,6 @@ impl LoginConfigHandler {
/// ///
/// * `config` - [`PeerConfig`] to save. /// * `config` - [`PeerConfig`] to save.
pub fn save_config(&mut self, config: PeerConfig) { pub fn save_config(&mut self, config: PeerConfig) {
if self.version == 0 {
log::info!("skip saving peer config {}", self.id);
return;
}
config.store(&self.id); config.store(&self.id);
self.config = config; self.config = config;
} }

View File

@ -850,11 +850,6 @@ impl<T: InvokeUiSession> Remote<T> {
} }
pub async fn sync_jobs_status_to_local(&mut self) -> bool { pub async fn sync_jobs_status_to_local(&mut self) -> bool {
let peer_version = self.handler.lc.read().unwrap().version;
if peer_version == 0 {
log::info!("skip saving job status");
return false;
}
log::info!("sync transfer job status"); log::info!("sync transfer job status");
let mut config: PeerConfig = self.handler.load_config(); let mut config: PeerConfig = self.handler.load_config();
let mut transfer_metas = TransferSerde::default(); let mut transfer_metas = TransferSerde::default();
@ -867,8 +862,10 @@ impl<T: InvokeUiSession> Remote<T> {
transfer_metas.write_jobs.push(json_str); transfer_metas.write_jobs.push(json_str);
} }
log::info!("meta: {:?}", transfer_metas); log::info!("meta: {:?}", transfer_metas);
config.transfer = transfer_metas; if config.transfer != transfer_metas {
self.handler.save_config(config); config.transfer = transfer_metas;
self.handler.save_config(config);
}
true true
} }