extmod/modlwip: accept: Fix error code for non-blocking mode.

In non-blocking mode, if no pending connection available, should return
EAGAIN, not ETIMEDOUT.
crypto-aes
Paul Sokolovsky 6 years ago
parent 5da8de2b66
commit 50de6d2fab

@ -732,7 +732,9 @@ STATIC mp_obj_t lwip_socket_accept(mp_obj_t self_in) {
// accept incoming connection
if (socket->incoming.connection == NULL) {
if (socket->timeout != -1) {
if (socket->timeout == 0) {
mp_raise_OSError(MP_EAGAIN);
} else if (socket->timeout != -1) {
for (mp_uint_t retries = socket->timeout / 100; retries--;) {
mp_hal_delay_ms(100);
if (socket->incoming.connection != NULL) break;

Loading…
Cancel
Save