Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions embassy-net/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- next-header -->
## Unreleased - ReleaseDate

- Avoid looping forever if the network interface is down.

## 0.9.0 - 2026-03-10

- raw: Removed unnecessary Driver type parameter from `RawSocket::new`
Expand Down
10 changes: 6 additions & 4 deletions embassy-net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -961,10 +961,12 @@ impl Inner {
self.apply_static_config()
}

if let Some(poll_at) = self.iface.poll_at(timestamp, &mut self.sockets) {
let t = pin!(Timer::at(instant_from_smoltcp(poll_at)));
if t.poll(cx).is_ready() {
cx.waker().wake_by_ref();
if self.link_up {
if let Some(poll_at) = self.iface.poll_at(timestamp, &mut self.sockets) {
let t = pin!(Timer::at(instant_from_smoltcp(poll_at)));
if t.poll(cx).is_ready() {
cx.waker().wake_by_ref();
}
}
}
Comment on lines +964 to 971
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gating iface.poll_at(...) on self.link_up prevents the runner from scheduling any future polls while the link is down. That can stop smoltcp’s time-based state machine from progressing (e.g., TCP set_timeout() / keep-alive timers) and may cause socket operations to hang indefinitely during a prolonged link-down period, despite the docs stating timeouts close the socket after the specified duration.

Consider still calling poll_at when the link is down, but suppress only the immediate re-poll case that causes the busy loop (e.g., if poll_at <= timestamp and !link_up, don’t wake immediately; optionally apply a small backoff), while still scheduling when poll_at is in the future so protocol/socket timers continue to run.

Copilot uses AI. Check for mistakes.
}
Expand Down
Loading