Skip to content

Commit eb85ecd

Browse files
committed
Fix for #24 / avahi - always broadcast to any of the enabled muticast addresses, regardless how we were contancted with a query
1 parent 6e017d9 commit eb85ecd

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

edge-mdns/src/io.rs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ where
198198
let len = q(send_buf.as_mut())?;
199199

200200
if len > 0 {
201-
self.broadcast_once(send, &send_buf.as_mut()[..len], true, true)
202-
.await?;
201+
self.broadcast_once(send, &send_buf.as_mut()[..len]).await?;
203202
}
204203

205204
Ok(())
@@ -235,7 +234,7 @@ where
235234
self.delay().await;
236235
}
237236

238-
self.broadcast_once(send, data, true, true).await?;
237+
self.broadcast_once(send, data).await?;
239238
}
240239
}
241240

@@ -304,28 +303,16 @@ where
304303

305304
info!("Replying to mDNS query from {remote}");
306305

307-
self.broadcast_once(
308-
send,
309-
data,
310-
matches!(remote, SocketAddr::V4(_)),
311-
matches!(remote, SocketAddr::V6(_)),
312-
)
313-
.await?;
306+
self.broadcast_once(send, data).await?;
314307
}
315308
}
316309
}
317310
}
318311

319-
async fn broadcast_once(
320-
&self,
321-
send: &mut S,
322-
data: &[u8],
323-
ipv4: bool,
324-
ipv6: bool,
325-
) -> Result<(), MdnsIoError<S::Error>> {
312+
async fn broadcast_once(&self, send: &mut S, data: &[u8]) -> Result<(), MdnsIoError<S::Error>> {
326313
for remote_addr in
327314
core::iter::once(SocketAddr::V4(SocketAddrV4::new(IP_BROADCAST_ADDR, PORT)))
328-
.filter(|_| ipv4 && self.ipv4_interface.is_some())
315+
.filter(|_| self.ipv4_interface.is_some())
329316
.chain(
330317
self.ipv6_interface
331318
.map(|interface| {
@@ -336,8 +323,7 @@ where
336323
interface,
337324
))
338325
})
339-
.into_iter()
340-
.filter(|_| ipv6),
326+
.into_iter(),
341327
)
342328
{
343329
if !data.is_empty() {

0 commit comments

Comments
 (0)