From 7e9182f3aa16f0a7d80edd1362a383fe68f1509c Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 8 Apr 2016 20:07:11 +0300 Subject: [PATCH] extmod/modwebsocket: Make sure to propagate EOF. --- extmod/modwebsocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/modwebsocket.c b/extmod/modwebsocket.c index 00ec5ee980..9f4e5ee7e8 100644 --- a/extmod/modwebsocket.c +++ b/extmod/modwebsocket.c @@ -68,7 +68,7 @@ STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int while (1) { if (self->to_recv != 0) { mp_uint_t out_sz = stream_p->read(self->sock, self->buf + self->buf_pos, self->to_recv, errcode); - if (out_sz == MP_STREAM_ERROR) { + if (out_sz == 0 || out_sz == MP_STREAM_ERROR) { return out_sz; } self->buf_pos += out_sz;