explicitly mem drop lazy init failure

This commit is contained in:
Edward Shen 2021-04-24 12:57:32 -04:00
parent 4a36541570
commit 0db06fcabd
Signed by: edward
GPG key ID: 19182661E818369F
2 changed files with 6 additions and 4 deletions

View file

@ -25,7 +25,7 @@ use crate::state::RwLockServerState;
pub const BASE64_CONFIG: base64::Config = base64::Config::new(base64::CharacterSet::UrlSafe, false);
static HTTP_CLIENT: Lazy<Client> = Lazy::new(|| Client::new());
static HTTP_CLIENT: Lazy<Client> = Lazy::new(Client::new);
const SERVER_ID_STRING: &str = concat!(
env!("CARGO_CRATE_NAME"),

View file

@ -102,9 +102,11 @@ impl ServerState {
}
let tls = resp.tls.unwrap();
let _ = TLS_PREVIOUSLY_CREATED.set(ArcSwap::from_pointee(tls.created_at));
let _ = TLS_SIGNING_KEY.set(ArcSwap::new(tls.priv_key));
let _ = TLS_CERTS.set(ArcSwap::from_pointee(tls.certs));
std::mem::drop(
TLS_PREVIOUSLY_CREATED.set(ArcSwap::from_pointee(tls.created_at)),
);
std::mem::drop(TLS_SIGNING_KEY.set(ArcSwap::new(tls.priv_key)));
std::mem::drop(TLS_CERTS.set(ArcSwap::from_pointee(tls.certs)));
Ok(Self {
precomputed_key: key,