From ec344702840c293d032d4202da1afeffdce0f7bf Mon Sep 17 00:00:00 2001 From: 21pages Date: Sun, 16 Jul 2023 09:59:46 +0800 Subject: [PATCH] clear hwcodec config rather than remove Signed-off-by: 21pages --- libs/hbb_common/src/config.rs | 9 +++------ libs/scrap/src/common/hwcodec.rs | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index cba3c0ca3..a12de5e5b 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -81,10 +81,7 @@ const CHARS: &[char] = &[ 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ]; -pub const RENDEZVOUS_SERVERS: &[&str] = &[ - "rs-ny.rustdesk.com", - "rs-sg.rustdesk.com", -]; +pub const RENDEZVOUS_SERVERS: &[&str] = &["rs-ny.rustdesk.com", "rs-sg.rustdesk.com"]; pub const RS_PUB_KEY: &str = match option_env!("RS_PUB_KEY") { Some(key) if !key.is_empty() => key, @@ -1350,8 +1347,8 @@ impl HwCodecConfig { Config::store_(self, "_hwcodec"); } - pub fn remove() { - std::fs::remove_file(Config::file_("_hwcodec")).ok(); + pub fn clear() { + HwCodecConfig::default().store(); } /// refresh current global HW_CODEC_CONFIG, usually uesd after HwCodecConfig::remove() diff --git a/libs/scrap/src/common/hwcodec.rs b/libs/scrap/src/common/hwcodec.rs index aba0d55d0..50ad33099 100644 --- a/libs/scrap/src/common/hwcodec.rs +++ b/libs/scrap/src/common/hwcodec.rs @@ -332,9 +332,9 @@ pub fn check_config_process() { use hbb_common::sysinfo::{ProcessExt, System, SystemExt}; std::thread::spawn(move || { - // Remove to avoid checking process errors + // Clear to avoid checking process errors // But when the program is just started, the configuration file has not been updated, and the new connection will read an empty configuration - HwCodecConfig::remove(); + HwCodecConfig::clear(); if let Ok(exe) = std::env::current_exe() { if let Some(file_name) = exe.file_name().to_owned() { let s = System::new_all();