diff options
| author | Gabriel Górski <[email protected]> | 2023-10-23 10:56:55 +0200 |
|---|---|---|
| committer | Gabriel Górski <[email protected]> | 2023-10-23 11:07:21 +0200 |
| commit | 18c9bcd44aa6fdb63d7fdf8b82fbb167a1b63e36 (patch) | |
| tree | 81fb4d5ef42ab0d4b98b289cc09f66a15a267321 /embassy-net | |
| parent | 88ada521461031b7241b09e40aa56f4e64827967 (diff) | |
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.
Diffstat (limited to 'embassy-net')
| -rw-r--r-- | embassy-net/src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
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<D: Driver> Inner<D> { | |||
| 860 | let socket = s.sockets.get_mut::<dhcpv4::Socket>(dhcp_handle); | 860 | let socket = s.sockets.get_mut::<dhcpv4::Socket>(dhcp_handle); |
| 861 | 861 | ||
| 862 | if self.link_up { | 862 | if self.link_up { |
| 863 | if old_link_up != self.link_up { | ||
| 864 | socket.reset(); | ||
| 865 | } | ||
| 863 | match socket.poll() { | 866 | match socket.poll() { |
| 864 | None => {} | 867 | None => {} |
| 865 | Some(dhcpv4::Event::Deconfigured) => { | 868 | Some(dhcpv4::Event::Deconfigured) => { |
