Skip to content

Commit

Permalink
gnrc/sock: recv avoid spinning xtimer
Browse files Browse the repository at this point in the history
  • Loading branch information
kfessel committed Sep 9, 2021
1 parent 45521e7 commit be28c53
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sys/net/gnrc/sock/gnrc_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ ssize_t gnrc_sock_recv(gnrc_sock_reg_t *reg, gnrc_pktsnip_t **pkt_out,
#ifdef MODULE_XTIMER
xtimer_t timeout_timer;

/* xtimer_spin would make this never receive anything.
* Avoid that by setting the minimal not spinning timeout. */
if (timeout < XTIMER_BACKOFF && timeout > 0) {
timeout = XTIMER_BACKOFF;
}

if ((timeout != SOCK_NO_TIMEOUT) && (timeout != 0)) {
timeout_timer.callback = _callback_put;
timeout_timer.arg = reg;
Expand Down

0 comments on commit be28c53

Please sign in to comment.