Skip to content
Snippets Groups Projects
Commit 883e987b authored by Damien George's avatar Damien George
Browse files

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.
parent 8c9758ff
No related branches found
No related tags found
No related merge requests found
...@@ -253,7 +253,13 @@ STATIC mp_obj_t socket_accept(const mp_obj_t arg0) { ...@@ -253,7 +253,13 @@ STATIC mp_obj_t socket_accept(const mp_obj_t arg0) {
if (errno != EAGAIN) exception_from_errno(errno); if (errno != EAGAIN) exception_from_errno(errno);
check_for_exceptions(); check_for_exceptions();
} }
if (new_fd < 0) mp_raise_OSError(MP_ETIMEDOUT); if (new_fd < 0) {
if (self->retries == 0) {
mp_raise_OSError(MP_EAGAIN);
} else {
mp_raise_OSError(MP_ETIMEDOUT);
}
}
// create new socket object // create new socket object
socket_obj_t *sock = m_new_obj_with_finaliser(socket_obj_t); socket_obj_t *sock = m_new_obj_with_finaliser(socket_obj_t);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment