cc3200: On ssl.read() or ssl.readall() ignore ssl layer closed error.

pull/1397/merge
Daniel Campora 2015-07-29 18:45:53 +02:00
rodzic fb3f9cff33
commit b56634e691
1 zmienionych plików z 9 dodań i 3 usunięć

Wyświetl plik

@ -422,9 +422,15 @@ STATIC mp_uint_t socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *e
mod_network_socket_obj_t *self = self_in;
mp_int_t ret = wlan_socket_recv(self, buf, size, errcode);
if (ret < 0) {
ret = MP_STREAM_ERROR;
// needed to convert simplelink's negative error codes to POSIX
(*errcode) *= -1;
// we need to ignore the socket closed error here because a readall() or read() without params
// only returns when the socket is closed by the other end
if (*errcode != SL_ESECCLOSED) {
ret = MP_STREAM_ERROR;
// needed to convert simplelink's negative error codes to POSIX
(*errcode) *= -1;
} else {
ret = 0;
}
}
return ret;
}