diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-06-04 13:45:37 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-06-04 13:45:37 +0300 |
commit | 50de6d2fab9ad67c6df0d74ce4b8c3704d1de090 (patch) | |
tree | 0c5771f73069446f3fbc3b548b4598a254a4dd0b | |
parent | 5da8de2b66d3f43107e1e745afa9bb6a4bf601eb (diff) | |
download | micropython-50de6d2fab9ad67c6df0d74ce4b8c3704d1de090.tar.gz micropython-50de6d2fab9ad67c6df0d74ce4b8c3704d1de090.zip |
extmod/modlwip: accept: Fix error code for non-blocking mode.
In non-blocking mode, if no pending connection available, should return
EAGAIN, not ETIMEDOUT.
-rw-r--r-- | extmod/modlwip.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/extmod/modlwip.c b/extmod/modlwip.c index d243985ad0..01190d200c 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -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; |