From 5156a5f1bdef61d45ca92a0b252947c0218d4028 Mon Sep 17 00:00:00 2001 From: HimbeerserverDE Date: Tue, 30 Jan 2024 18:57:27 +0100 Subject: poll socket recv before to_send Fixes reply packets not being read from the socket. --- src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index e82ac57..3c9e3fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -188,6 +188,13 @@ async fn main() -> Result<()> { } }, + result = sock.recv_from(&mut buf) => { + let (n, _) = result?; + let buf = &buf[..n]; + + logged_handle(&mut dhcp6, &mut dhcp6c, buf); + } + packet = dhcp6c.to_send() => send_dhcp6(&mut dhcp6, &sock, packet.0, packet.1).await, result = dhcp6c_rx.changed() => { @@ -221,13 +228,6 @@ async fn main() -> Result<()> { println!("[info] <> invalidate"); } } - - result = sock.recv_from(&mut buf) => { - let (n, _) = result?; - let buf = &buf[..n]; - - logged_handle(&mut dhcp6, &mut dhcp6c, buf); - } } } } -- cgit v1.2.3