diff options
author | Damien George <damien.p.george@gmail.com> | 2017-03-03 15:46:23 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-07-25 11:53:26 +1000 |
commit | a10467b58ab92352217c7ab42eafd320bb671565 (patch) | |
tree | 7b9a1a24f1d69df96ac4aa711680aefa129da472 | |
parent | 04552ff71b6c722b21597d93481f024c72457cef (diff) | |
download | micropython-a10467b58ab92352217c7ab42eafd320bb671565.tar.gz micropython-a10467b58ab92352217c7ab42eafd320bb671565.zip |
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.
-rw-r--r-- | extmod/modussl_mbedtls.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c index f4b551cb9b..ef3f319fe1 100644 --- a/extmod/modussl_mbedtls.c +++ b/extmod/modussl_mbedtls.c @@ -192,6 +192,10 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in); int ret = mbedtls_ssl_read(&o->ssl, buf, size); + if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) { + // end of stream + return 0; + } if (ret >= 0) { return ret; } |