mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-12 14:41:28 +03:00
formatting
This commit is contained in:
committed by
Ferdinand Schober
parent
ae5f3e5303
commit
9593b97fbe
13
src/dns.rs
13
src/dns.rs
@@ -1,5 +1,5 @@
|
|||||||
use local_channel::mpsc::{channel, Receiver, Sender};
|
use local_channel::mpsc::{channel, Receiver, Sender};
|
||||||
use tokio::task::{JoinHandle, spawn_local};
|
use tokio::task::{spawn_local, JoinHandle};
|
||||||
|
|
||||||
use hickory_resolver::{error::ResolveError, TokioAsyncResolver};
|
use hickory_resolver::{error::ResolveError, TokioAsyncResolver};
|
||||||
|
|
||||||
@@ -16,10 +16,7 @@ impl DnsResolver {
|
|||||||
let resolver = TokioAsyncResolver::tokio_from_system_conf()?;
|
let resolver = TokioAsyncResolver::tokio_from_system_conf()?;
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
let _task = spawn_local(Self::run(server, resolver, rx));
|
let _task = spawn_local(Self::run(server, resolver, rx));
|
||||||
Ok(Self {
|
Ok(Self { _task, tx })
|
||||||
_task,
|
|
||||||
tx,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn resolve(&self, host: ClientHandle) {
|
pub(crate) fn resolve(&self, host: ClientHandle) {
|
||||||
@@ -33,7 +30,11 @@ impl DnsResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn do_dns(server: &Server, resolver: &TokioAsyncResolver, rx: &mut Receiver<ClientHandle>) {
|
async fn do_dns(
|
||||||
|
server: &Server,
|
||||||
|
resolver: &TokioAsyncResolver,
|
||||||
|
rx: &mut Receiver<ClientHandle>,
|
||||||
|
) {
|
||||||
loop {
|
loop {
|
||||||
let handle = rx.recv().await.expect("channel closed");
|
let handle = rx.recv().await.expect("channel closed");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user