fix: ClientSecure.available() fix for connection closed by remote socket (#9869)

This commit is contained in:
Juraj Andrássy 2024-06-17 21:40:10 +02:00 committed by GitHub
parent 1efab83432
commit 5c22402025
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -305,9 +305,11 @@ int NetworkClientSecure::available() {
res = data_to_read(sslclient.get()); res = data_to_read(sslclient.get());
if (res < 0 && !_stillinPlainStart) { if (res < 0 && !_stillinPlainStart) {
log_e("Closing connection on failed available check"); if (res != MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
log_e("Closing connection on failed available check");
}
stop(); stop();
return peeked ? peeked : res; return peeked;
} }
return res + peeked; return res + peeked;
} }

View file

@ -27,7 +27,7 @@
const char *pers = "esp32-tls"; const char *pers = "esp32-tls";
static int _handle_error(int err, const char *function, int line) { static int _handle_error(int err, const char *function, int line) {
if (err == -30848) { if (err == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
return err; return err;
} }
#ifdef MBEDTLS_ERROR_C #ifdef MBEDTLS_ERROR_C