From fef0d9818a52c2e8331590a18a49cdd3fa64ae81 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 14 Apr 2016 00:58:51 +0300 Subject: [PATCH] extmod/modlwip: lwip_tcp_receive(): Properly handle EOF for non-blocking sock. --- extmod/modlwip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extmod/modlwip.c b/extmod/modlwip.c index 1ebcd8923c..441fd8cec9 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -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; }