mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 09:09:17 +00:00
client: remove DnsPeerMgrDirtyFlags
This commit is contained in:
@@ -61,7 +61,7 @@ impl DnsClient {
|
|||||||
rpc: &mut StandAloneClient<TcpTunnelConnector>,
|
rpc: &mut StandAloneClient<TcpTunnelConnector>,
|
||||||
heartbeat: &mut HeartbeatRequest,
|
heartbeat: &mut HeartbeatRequest,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let request = if heartbeat.snapshot.is_none() || self.mgr.dirty.peers.reset() {
|
let request = if heartbeat.snapshot.is_none() || self.mgr.dirty.reset() {
|
||||||
heartbeat.update(self.mgr.snapshot());
|
heartbeat.update(self.mgr.snapshot());
|
||||||
heartbeat.clone()
|
heartbeat.clone()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -39,15 +39,10 @@ impl TryFrom<DnsExportConfig> for DnsPeerInfo {
|
|||||||
|
|
||||||
const DNS_PEER_TTL: Duration = Duration::from_secs(3);
|
const DNS_PEER_TTL: Duration = Duration::from_secs(3);
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
|
||||||
pub struct DnsPeerMgrDirtyFlags {
|
|
||||||
pub(crate) peers: DirtyFlag,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deref)]
|
#[derive(Debug, Deref)]
|
||||||
pub struct DnsPeerMgr {
|
pub struct DnsPeerMgr {
|
||||||
peers: Cache<PeerId, DnsPeerInfo>,
|
peers: Cache<PeerId, DnsPeerInfo>,
|
||||||
pub(super) dirty: DirtyState<DnsPeerMgrDirtyFlags>,
|
pub(super) dirty: DirtyState<DirtyFlag>,
|
||||||
|
|
||||||
#[deref]
|
#[deref]
|
||||||
mgr: Arc<PeerManager>,
|
mgr: Arc<PeerManager>,
|
||||||
@@ -92,7 +87,7 @@ impl DnsPeerMgr {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.dirty.peers.mark();
|
self.dirty.mark();
|
||||||
|
|
||||||
match self.fetch(peer_id).await {
|
match self.fetch(peer_id).await {
|
||||||
Ok(info) => {
|
Ok(info) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user