summaryrefslogtreecommitdiff
path: root/extmod/modlwip.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/modlwip.c')
-rw-r--r--extmod/modlwip.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index 216e81749..1d557a6a8 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -757,8 +757,11 @@ STATIC mp_uint_t lwip_tcp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_
return 0;
}
} else if (socket->state != STATE_CONNECTED) {
- assert(socket->state < 0);
- *_errno = error_lookup_table[-socket->state];
+ if (socket->state >= STATE_NEW) {
+ *_errno = MP_ENOTCONN;
+ } else {
+ *_errno = error_lookup_table[-socket->state];
+ }
return -1;
}
}