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.
This commit is contained in:
parent
88ada52146
commit
18c9bcd44a
1 changed files with 3 additions and 0 deletions
|
@ -860,6 +860,9 @@ impl<D: Driver> Inner<D> {
|
|||
let socket = s.sockets.get_mut::<dhcpv4::Socket>(dhcp_handle);
|
||||
|
||||
if self.link_up {
|
||||
if old_link_up != self.link_up {
|
||||
socket.reset();
|
||||
}
|
||||
match socket.poll() {
|
||||
None => {}
|
||||
Some(dhcpv4::Event::Deconfigured) => {
|
||||
|
|
Loading…
Reference in a new issue