Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions src/executor/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,16 @@ async fn network_run() {

let now = now();

match nic.poll_common(now) {
PollResult::SocketStateChanged => {
// Progress was made
cx.waker().wake_by_ref();
}
PollResult::None => {
// Very likely no progress can be made, so set up a timer interrupt to wake the waker
NETWORK_WAKER.lock().register(cx.waker());
nic.set_polling_mode(false);
if let Some(wakeup_time) = nic.poll_delay(now).map(|d| d.total_micros()) {
create_timer(Source::Network, wakeup_time);
trace!("Configured an interrupt for {wakeup_time:?}");
}
if nic.poll_common(now) == PollResult::SocketStateChanged || cfg!(feature = "idle-poll") {
// Progress was made or we want to poll when idle.
cx.waker().wake_by_ref();
} else {
// Very likely no progress can be made, so set up a timer interrupt to wake the waker
NETWORK_WAKER.lock().register(cx.waker());
nic.set_polling_mode(false);
if let Some(wakeup_time) = nic.poll_delay(now).map(|d| d.total_micros()) {
create_timer(Source::Network, wakeup_time);
trace!("Configured an interrupt for {wakeup_time:?}");
}
}

Expand Down
Loading