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