mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 09:09:17 +00:00
server: rename zones dirty flag to catalog
This commit is contained in:
@@ -41,7 +41,7 @@ const DNS_CLIENT_TTL: Duration = Duration::from_secs(5);
|
|||||||
// TODO: same as DnsPeerMgrDirtyState
|
// TODO: same as DnsPeerMgrDirtyState
|
||||||
#[derive(Debug, Default, Deref, DerefMut)]
|
#[derive(Debug, Default, Deref, DerefMut)]
|
||||||
pub struct DnsClientMgrDirtyState {
|
pub struct DnsClientMgrDirtyState {
|
||||||
pub(super) zones: DirtyFlag,
|
pub(super) catalog: DirtyFlag,
|
||||||
pub(super) addresses: DirtyFlag,
|
pub(super) addresses: DirtyFlag,
|
||||||
pub(super) listeners: DirtyFlag,
|
pub(super) listeners: DirtyFlag,
|
||||||
#[deref]
|
#[deref]
|
||||||
@@ -141,7 +141,7 @@ impl DnsClientMgrRpc for DnsClientMgr {
|
|||||||
let new = DnsClientInfo::try_from(snapshot)?;
|
let new = DnsClientInfo::try_from(snapshot)?;
|
||||||
let old = self.clients.get(&id).await.unwrap_or_default();
|
let old = self.clients.get(&id).await.unwrap_or_default();
|
||||||
if new.digest != old.digest {
|
if new.digest != old.digest {
|
||||||
self.dirty.zones.mark();
|
self.dirty.catalog.mark();
|
||||||
if new.addresses != old.addresses {
|
if new.addresses != old.addresses {
|
||||||
self.dirty.addresses.mark();
|
self.dirty.addresses.mark();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,10 +148,6 @@ pub struct DnsServer {
|
|||||||
const DNS_SERVER_LISTENER_TCP_TIMEOUT: Duration = Duration::from_secs(5);
|
const DNS_SERVER_LISTENER_TCP_TIMEOUT: Duration = Duration::from_secs(5);
|
||||||
|
|
||||||
impl DnsServer {
|
impl DnsServer {
|
||||||
async fn reload_zones(&self) {
|
|
||||||
self.catalog.replace(self.mgr.catalog()).await;
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn reload_addresses(&self, addresses: impl IntoIterator<Item = NameServerAddr>) {
|
async fn reload_addresses(&self, addresses: impl IntoIterator<Item = NameServerAddr>) {
|
||||||
let addresses = addresses.into_iter().collect::<HashSet<_>>();
|
let addresses = addresses.into_iter().collect::<HashSet<_>>();
|
||||||
|
|
||||||
@@ -208,8 +204,8 @@ impl DnsServer {
|
|||||||
loop {
|
loop {
|
||||||
dirty.notified().await;
|
dirty.notified().await;
|
||||||
|
|
||||||
if dirty.zones.reset() {
|
if dirty.catalog.reset() {
|
||||||
self.reload_zones(&self.mgr.collect_zones()).await;
|
self.catalog.replace(self.mgr.catalog()).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
if dirty.addresses.reset() {
|
if dirty.addresses.reset() {
|
||||||
|
|||||||
Reference in New Issue
Block a user