mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-16 05:31:29 +03:00
fix: initial dns resolve was not working
This commit is contained in:
@@ -199,6 +199,7 @@ impl Server {
|
|||||||
let producer_notify = producer_notify_tx.clone();
|
let producer_notify = producer_notify_tx.clone();
|
||||||
let consumer_notify = consumer_notify_tx.clone();
|
let consumer_notify = consumer_notify_tx.clone();
|
||||||
let frontend_ch = frontend_tx.clone();
|
let frontend_ch = frontend_tx.clone();
|
||||||
|
let resolve_ch = resolve_tx.clone();
|
||||||
let mut frontend_task = tokio::task::spawn_local(async move {
|
let mut frontend_task = tokio::task::spawn_local(async move {
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
@@ -214,7 +215,7 @@ impl Server {
|
|||||||
}
|
}
|
||||||
event = frontend_rx.recv() => {
|
event = frontend_rx.recv() => {
|
||||||
let frontend_event = event.ok_or(anyhow!("frontend channel closed"))?;
|
let frontend_event = event.ok_or(anyhow!("frontend channel closed"))?;
|
||||||
if server.handle_frontend_event(&producer_notify, &consumer_notify, &resolve_tx, &mut frontend, &port_tx, frontend_event).await {
|
if server.handle_frontend_event(&producer_notify, &consumer_notify, &resolve_ch, &mut frontend, &port_tx, frontend_event).await {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -423,16 +424,19 @@ impl Server {
|
|||||||
.get_client_states()
|
.get_client_states()
|
||||||
.filter_map(|s| {
|
.filter_map(|s| {
|
||||||
if s.active {
|
if s.active {
|
||||||
Some(s.client.handle)
|
Some((s.client.handle, s.client.hostname.clone()))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
for client in active {
|
for (handle, hostname) in active {
|
||||||
frontend_tx
|
frontend_tx
|
||||||
.send(FrontendEvent::ActivateClient(client, true))
|
.send(FrontendEvent::ActivateClient(handle, true))
|
||||||
.await?;
|
.await?;
|
||||||
|
if let Some(hostname) = hostname {
|
||||||
|
let _ = resolve_tx.send((hostname, handle)).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
|
|||||||
Reference in New Issue
Block a user