utils: add DirtyState

This commit is contained in:
Luna Yao
2026-02-21 23:24:17 +01:00
parent e9a0e4f042
commit efcdf4c456
5 changed files with 34 additions and 29 deletions
+4 -7
View File
@@ -1,7 +1,5 @@
use super::{utils::NameServerAddr, zone::Zone};
use crate::common::PeerId;
use super::utils::NameServerAddr;
use crate::dns::client_mgr::DnsClientMgr;
use cidr::Ipv4Inet;
use derivative::Derivative;
use derive_more::{Deref, DerefMut, From, Into};
use hickory_proto::rr::Record;
@@ -20,9 +18,8 @@ use std::{sync::Arc, time::Duration};
use tokio::net::{TcpListener, UdpSocket};
use tokio::{sync::RwLock, task::JoinHandle};
use tokio_util::sync::CancellationToken;
use crate::dns::peer_mgr::DnsPeerMgr;
use crate::peers::peer_manager::PeerManager;
use crate::proto::dns::{DnsClientMgrRpcServer, DnsPeerMgrRpcServer};
use crate::proto::dns::DnsClientMgrRpcServer;
#[derive(Clone)]
pub struct DynamicCatalog {
@@ -214,7 +211,7 @@ impl DnsServer {
let dirty = &self.mgr.dirty;
let mut runtime = None;
loop {
dirty.notified().await;
dirty.notify.notified().await;
if dirty.catalog.reset() {
self.catalog.replace(self.mgr.catalog()).await;
@@ -231,7 +228,7 @@ impl DnsServer {
{
tracing::error!("failed to reload listeners: {:?}", e);
dirty.listeners.mark();
dirty.notify_one();
dirty.notify.notify_one();
}
}