mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-04 01:55:41 +00:00
server: use select! for run
This commit is contained in:
@@ -225,8 +225,7 @@ impl DnsServer {
|
||||
let dirty = &self.mgr.dirty;
|
||||
let mut runtime = None;
|
||||
|
||||
tokio::join!(
|
||||
async {
|
||||
let reload_catalog = async {
|
||||
loop {
|
||||
dirty.catalog.notified().await;
|
||||
if dirty.catalog.reset() {
|
||||
@@ -234,8 +233,9 @@ impl DnsServer {
|
||||
}
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
},
|
||||
async {
|
||||
};
|
||||
|
||||
let reload_addresses = async {
|
||||
loop {
|
||||
dirty.addresses.notified().await;
|
||||
if dirty.addresses.reset() {
|
||||
@@ -243,8 +243,9 @@ impl DnsServer {
|
||||
}
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
},
|
||||
async {
|
||||
};
|
||||
|
||||
let reload_listeners = async {
|
||||
loop {
|
||||
dirty.listeners.notified().await;
|
||||
if dirty.listeners.reset() {
|
||||
@@ -258,7 +259,12 @@ impl DnsServer {
|
||||
}
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
tokio::select!(
|
||||
_ = reload_catalog => {},
|
||||
_ = reload_addresses => {},
|
||||
_ = reload_listeners => {},
|
||||
);
|
||||
|
||||
self.reload_addresses(iter::empty()).await;
|
||||
|
||||
Reference in New Issue
Block a user