Skip to content

Commit 50de6d2

Browse files
committed
extmod/modlwip: accept: Fix error code for non-blocking mode.
In non-blocking mode, if no pending connection available, should return EAGAIN, not ETIMEDOUT.
1 parent 5da8de2 commit 50de6d2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

extmod/modlwip.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,9 @@ STATIC mp_obj_t lwip_socket_accept(mp_obj_t self_in) {
732732

733733
// accept incoming connection
734734
if (socket->incoming.connection == NULL) {
735-
if (socket->timeout != -1) {
735+
if (socket->timeout == 0) {
736+
mp_raise_OSError(MP_EAGAIN);
737+
} else if (socket->timeout != -1) {
736738
for (mp_uint_t retries = socket->timeout / 100; retries--;) {
737739
mp_hal_delay_ms(100);
738740
if (socket->incoming.connection != NULL) break;

0 commit comments

Comments
 (0)