Skip to content

Commit a10467b

Browse files
committed
extmod/modussl_mbedtls: When reading and peer wants to close, return 0.
If this particular code is returned then there's no more data, it's not really an error.
1 parent 04552ff commit a10467b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

extmod/modussl_mbedtls.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc
192192
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
193193

194194
int ret = mbedtls_ssl_read(&o->ssl, buf, size);
195+
if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
196+
// end of stream
197+
return 0;
198+
}
195199
if (ret >= 0) {
196200
return ret;
197201
}

0 commit comments

Comments
 (0)