Skip to content

Commit 25e54e3

Browse files
committed
fix: call ring provider install exactly once via Once
Use std::sync::Once in ensure_ring_provider so that install_default() is only attempted on the first call per process, avoiding redundant global-state mutations on subsequent calls.
1 parent ac07cf0 commit 25e54e3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

sdk-libs/photon-api/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
include!("codegen.rs");
1313

1414
fn ensure_ring_provider() {
15-
let _ = rustls::crypto::ring::default_provider().install_default();
15+
use std::sync::Once;
16+
static ONCE: Once = Once::new();
17+
ONCE.call_once(|| {
18+
let _ = rustls::crypto::ring::default_provider().install_default();
19+
});
1620
}
1721

1822
pub mod apis {

0 commit comments

Comments
 (0)