cherrypicked from b6a8590c34 its v6 its better

This commit is contained in:
lda committed 2025-08-31 17:47:06 +07:00
1 parent cc7f8013ad
commit 68377dcae7
2 files changed
+9 -2

No files matched your search

+4 -1
View File
@@ -1,6 +1,7 @@
pub mod impls;
use std::{io, net::IpAddr};
use futures::TryFutureExt;
use macaddr::MacAddr;
use tokio::net::UdpSocket;
@@ -74,7 +75,9 @@ impl WakeTargetResult {
pub async fn _wake_multi(
targets: impl IntoIterator<Item = WakeTarget>,
) -> io::Result<Vec<WakeTargetResult>> {
let sock = UdpSocket::bind(":0").await?;
let sock = UdpSocket::bind("[::]:0")
.or_else(|_| UdpSocket::bind(":0"))
.await?;
sock.set_broadcast(true)?;
let fs = targets.into_iter().map(|t| wake_one(&sock, t));
Ok(futures::future::join_all(fs).await)