From 18c9bcd44aa6fdb63d7fdf8b82fbb167a1b63e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20G=C3=B3rski?= Date: Mon, 23 Oct 2023 10:56:55 +0200 Subject: [PATCH] net: Reset DHCP socket when the link up is detected Previously, because DHCP DISCOVER is sent before the link is established, socket has to timeout first. Which takes extra 10 s. Now if the state of the link changed to up, socket is explicitly reset so the DISCOVER is repeated much earlier and DHCP configuration is acquired much faster. --- embassy-net/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index c41faee2f..798962875 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs @@ -860,6 +860,9 @@ impl Inner { let socket = s.sockets.get_mut::(dhcp_handle); if self.link_up { + if old_link_up != self.link_up { + socket.reset(); + } match socket.poll() { None => {} Some(dhcpv4::Event::Deconfigured) => {