extmod/modlwip: lwip_tcp_receive(): Properly handle EOF for non-blocking sock.

This commit is contained in:
Paul Sokolovsky 2016-04-14 00:58:51 +03:00
parent f30b6f0af5
commit fef0d9818a
1 changed files with 3 additions and 0 deletions

View File

@ -451,6 +451,9 @@ STATIC mp_uint_t lwip_tcp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_
// Non-blocking socket
if (socket->timeout == 0) {
if (socket->state == STATE_PEER_CLOSED) {
return 0;
}
*_errno = EAGAIN;
return -1;
}