more equal check in config

This commit is contained in:
rustdesk 2022-01-05 21:12:07 +08:00
parent 1b61b77fbe
commit 32c5437c5d
2 changed files with 11 additions and 2 deletions

View File

@ -76,7 +76,7 @@ pub struct Config {
keys_confirmed: HashMap<String, bool>, keys_confirmed: HashMap<String, bool>,
} }
#[derive(Debug, Default, Serialize, Deserialize, Clone)] #[derive(Debug, Default, PartialEq, Serialize, Deserialize, Clone)]
pub struct Socks5Server { pub struct Socks5Server {
#[serde(default)] #[serde(default)]
pub proxy: String, pub proxy: String,
@ -502,6 +502,9 @@ impl Config {
pub fn set_key_pair(pair: (Vec<u8>, Vec<u8>)) { pub fn set_key_pair(pair: (Vec<u8>, Vec<u8>)) {
let mut config = CONFIG.write().unwrap(); let mut config = CONFIG.write().unwrap();
if config.key_pair == pair {
return;
}
config.key_pair = pair; config.key_pair = pair;
config.store(); config.store();
} }
@ -534,6 +537,9 @@ impl Config {
pub fn set_options(v: HashMap<String, String>) { pub fn set_options(v: HashMap<String, String>) {
let mut config = CONFIG2.write().unwrap(); let mut config = CONFIG2.write().unwrap();
if config.options == v {
return;
}
config.options = v; config.options = v;
config.store(); config.store();
} }
@ -636,6 +642,9 @@ impl Config {
pub fn set_socks(socks: Option<Socks5Server>) { pub fn set_socks(socks: Option<Socks5Server>) {
let mut config = CONFIG2.write().unwrap(); let mut config = CONFIG2.write().unwrap();
if config.socks == socks {
return;
}
config.socks = socks; config.socks = socks;
config.store(); config.store();
} }

View File

@ -287,4 +287,4 @@ class MultipleSessions: Reactor.Component {
} }
} }
view.on("size", function() { if (app.multipleSessions) app.multipleSessions.onSize(); }); view.on("size", function() { if (app && app.multipleSessions) app.multipleSessions.onSize(); });