replace parking_lot with std

This commit is contained in:
Luna Yao
2026-04-17 18:50:12 +02:00
parent 3795800975
commit b94ab414a0
+11 -12
View File
@@ -1,5 +1,12 @@
use arc_swap::ArcSwap;
use crossbeam::atomic::AtomicCell;
use dashmap::DashMap;
use hmac::{Hmac, Mac};
use sha2::Sha256;
use socket2::Protocol;
use std::sync::RwLock;
use std::{ use std::{
collections::{HashMap, hash_map::DefaultHasher}, collections::{hash_map::DefaultHasher, HashMap},
hash::Hasher, hash::Hasher,
iter, iter,
net::{IpAddr, SocketAddr}, net::{IpAddr, SocketAddr},
@@ -7,15 +14,12 @@ use std::{
time::{SystemTime, UNIX_EPOCH}, time::{SystemTime, UNIX_EPOCH},
}; };
use arc_swap::ArcSwap;
use dashmap::DashMap;
use super::{ use super::{
PeerId,
config::{ConfigLoader, Flags}, config::{ConfigLoader, Flags},
netns::NetNS, netns::NetNS,
network::IPCollector, network::IPCollector,
stun::{StunInfoCollector, StunInfoCollectorTrait}, stun::{StunInfoCollector, StunInfoCollectorTrait},
PeerId,
}; };
#[cfg(feature = "magic-dns")] #[cfg(feature = "magic-dns")]
use crate::dns::{ use crate::dns::{
@@ -37,11 +41,6 @@ use crate::{
rpc_service::protected_port, rpc_service::protected_port,
tunnel::matches_protocol, tunnel::matches_protocol,
}; };
use crossbeam::atomic::AtomicCell;
use hmac::{Hmac, Mac};
use parking_lot::RwLock;
use sha2::Sha256;
use socket2::Protocol;
pub type NetworkIdentity = crate::common::config::NetworkIdentity; pub type NetworkIdentity = crate::common::config::NetworkIdentity;
@@ -684,11 +683,11 @@ impl GlobalCtx {
#[cfg(feature = "magic-dns")] #[cfg(feature = "magic-dns")]
impl DnsGlobalCtxExt for GlobalCtx { impl DnsGlobalCtxExt for GlobalCtx {
fn dns_server(&self) -> Option<Arc<DnsServer>> { fn dns_server(&self) -> Option<Arc<DnsServer>> {
self.dns_server.read().clone() self.dns_server.read().unwrap().clone()
} }
fn set_dns_server(&self, dns: Option<Arc<DnsServer>>) { fn set_dns_server(&self, dns: Option<Arc<DnsServer>>) {
*self.dns_server.write() = dns; *self.dns_server.write().unwrap() = dns;
} }
fn dns_self_zone(&self) -> crate::dns::config::zone::ZoneConfig { fn dns_self_zone(&self) -> crate::dns::config::zone::ZoneConfig {