From 6a3bcdddc97ef46e407fc94f222f2d2deeeb9ac3 Mon Sep 17 00:00:00 2001 From: zephyr Date: Thu, 22 Feb 2024 01:26:54 +0900 Subject: [PATCH] dns lazy init. concern about thread-safety --- realm_core/src/dns/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/realm_core/src/dns/mod.rs b/realm_core/src/dns/mod.rs index ad5d489..d2675d6 100644 --- a/realm_core/src/dns/mod.rs +++ b/realm_core/src/dns/mod.rs @@ -10,8 +10,12 @@ use resolver::lookup_ip::{LookupIp, LookupIpIter}; pub use resolver::config; use config::{ResolverOpts, ResolverConfig}; +#[cfg(not(feature = "multi-thread"))] use once_cell::unsync::{OnceCell, Lazy}; +#[cfg(feature = "multi-thread")] +use once_cell::{unsync::OnceCell, sync::Lazy}; + use crate::endpoint::RemoteAddr; /// Dns config.