Consume pre-existing socket_wake before sleeping

This commit is contained in:
J. Nick Koston
2026-03-04 22:52:42 -10:00
parent fe20550127
commit 1e2c892139
@@ -74,6 +74,13 @@ void socket_delay(uint32_t ms) {
yield();
return;
}
// If a wake was already signalled, consume it and return immediately
// instead of going to sleep. This avoids losing a wake that arrived
// between loop iterations.
if (s_socket_woke) {
s_socket_woke = false;
return;
}
s_socket_woke = false;
s_delay_expired = false;
// Set a one-shot timer to wake us after the timeout.