Skip to content

Commit

Permalink
fix: ClientSecure.available() fix for connection closed by remote soc…
Browse files Browse the repository at this point in the history
…ket (#9869)
  • Loading branch information
JAndrassy committed Jun 17, 2024
1 parent 1efab83 commit 5c22402
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions libraries/NetworkClientSecure/src/NetworkClientSecure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,11 @@ int NetworkClientSecure::available() {
res = data_to_read(sslclient.get());

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();
return peeked ? peeked : res;
return peeked;
}
return res + peeked;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/NetworkClientSecure/src/ssl_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
const char *pers = "esp32-tls";

static int _handle_error(int err, const char *function, int line) {
if (err == -30848) {
if (err == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
return err;
}
#ifdef MBEDTLS_ERROR_C
Expand Down

0 comments on commit 5c22402

Please sign in to comment.