Merge pull request #1104 from Heap-Hop/master

fix: android build & CONFIG deadlock
This commit is contained in:
RustDesk authored and GitHub committed 2022-07-29 18:59:34 +08:00
commit 06a4eaed10
7 files changed
+48 -21

No files matched your search

+12
View File
@@ -596,6 +596,18 @@ impl Config {
config.store();
}
// * Manually make sure no gen_keypair more than once
// for uuid, avoid deadlock
pub fn get_key_pair_without_lock() -> (Vec<u8>, Vec<u8>) {
let mut config = Config::load_::<Config>("");
if config.key_pair.0.is_empty() {
let (pk, sk) = sign::gen_keypair();
config.key_pair = (sk.0.to_vec(), pk.0.into());
Config::store_(&config, "");
}
config.key_pair.clone()
}
pub fn get_key_pair() -> (Vec<u8>, Vec<u8>) {
// lock here to make sure no gen_keypair more than once
let mut config = CONFIG.write().unwrap();