Skip to content

Commit b56634e

Browse files
author
Daniel Campora
committed
cc3200: On ssl.read() or ssl.readall() ignore ssl layer closed error.
1 parent fb3f9cf commit b56634e

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

cc3200/mods/modusocket.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,15 @@ STATIC mp_uint_t socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *e
422422
mod_network_socket_obj_t *self = self_in;
423423
mp_int_t ret = wlan_socket_recv(self, buf, size, errcode);
424424
if (ret < 0) {
425-
ret = MP_STREAM_ERROR;
426-
// needed to convert simplelink's negative error codes to POSIX
427-
(*errcode) *= -1;
425+
// we need to ignore the socket closed error here because a readall() or read() without params
426+
// only returns when the socket is closed by the other end
427+
if (*errcode != SL_ESECCLOSED) {
428+
ret = MP_STREAM_ERROR;
429+
// needed to convert simplelink's negative error codes to POSIX
430+
(*errcode) *= -1;
431+
} else {
432+
ret = 0;
433+
}
428434
}
429435
return ret;
430436
}

0 commit comments

Comments
 (0)