mirror of https://github.com/vinc/moros.git
Reduce DHCP sleep time (#610)
* Redure DHCP sleep time * Rename delay variable
This commit is contained in:
parent
348b2b6d63
commit
18ba564a1e
|
@ -64,8 +64,9 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
|
|||
Some(dhcpv4::Event::Deconfigured) => {}
|
||||
}
|
||||
|
||||
if let Some(d) = iface.poll_delay(time, &sockets) {
|
||||
syscall::sleep((d.total_micros() as f64) / 1000000.0);
|
||||
if let Some(delay) = iface.poll_delay(time, &sockets) {
|
||||
let d = (delay.total_micros() as f64) / 1000000.0;
|
||||
syscall::sleep(d.min(0.1)); // Don't sleep longer than 0.1s
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -451,10 +451,10 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
|
|||
send_queue.clear();
|
||||
}
|
||||
}
|
||||
if let Some(wait_duration) = iface.poll_delay(time, &sockets) {
|
||||
let t = wait_duration.total_micros() / POLL_DELAY_DIV as u64;
|
||||
if t > 0 {
|
||||
syscall::sleep((t as f64) / 1000000.0);
|
||||
if let Some(delay) = iface.poll_delay(time, &sockets) {
|
||||
let d = delay.total_micros() / POLL_DELAY_DIV as u64;
|
||||
if d > 0 {
|
||||
syscall::sleep((d as f64) / 1000000.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue