mbedtls: fix handling SSL close notification
[project/ustream-ssl.git] / ustream-mbedtls.c
index 7fbfba5..e176afe 100644 (file)
@@ -316,6 +316,9 @@ __hidden int __ustream_ssl_read(struct ustream_ssl *us, char *buf, int len)
                if (ssl_do_wait(ret))
                        return U_SSL_PENDING;
 
+               if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)
+                       return 0;
+
                ustream_ssl_error(us, ret);
                return U_SSL_ERROR;
        }