8000 esp32/modsocket: Raise EAGAIN when accept fails in non-blocking mode. · guidebee/micropython@883e987 · GitHub
[go: up one dir, main page]

Skip to content

Commit 883e987

Browse files
committed
esp32/modsocket: Raise EAGAIN when accept fails in non-blocking mode.
EAGAIN should be for pure non-blocking mode and ETIMEDOUT for when there is a finite (but non-zero) timeout enabled.
1 parent 8c9758f commit 883e987

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ports/esp32/modsocket.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,13 @@ STATIC mp_obj_t socket_accept(const mp_obj_t arg0) {
253253
if (errno != EAGAIN) exception_from_errno(errno);
254254
check_for_exceptions();
255255
}
256-
if (new_fd < 0) mp_raise_OSError(MP_ETIMEDOUT);
256+
if (new_fd < 0) {
257+
if (self->retries == 0) {
258+
mp_raise_OSError(MP_EAGAIN);
259+
} else {
260+
mp_raise_OSError(MP_ETIMEDOUT);
261+
}
262+
}
257263

258264
// create new socket object
259265
socket_obj_t *sock = m_new_obj_with_finaliser(socket_obj_t);

0 commit comments

Comments
 (0)
0