Skip to content

Commit 5c22402

Browse files
authored
fix: ClientSecure.available() fix for connection closed by remote socket (#9869)
1 parent 1efab83 commit 5c22402

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: libraries/NetworkClientSecure/src/NetworkClientSecure.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,11 @@ int NetworkClientSecure::available() {
305305
res = data_to_read(sslclient.get());
306306

307307
if (res < 0 && !_stillinPlainStart) {
308-
log_e("Closing connection on failed available check");
308+
if (res != MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
309+
log_e("Closing connection on failed available check");
310+
}
309311
stop();
310-
return peeked ? peeked : res;
312+
return peeked;
311313
}
312314
return res + peeked;
313315
}

Diff for: libraries/NetworkClientSecure/src/ssl_client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
const char *pers = "esp32-tls";
2828

2929
static int _handle_error(int err, const char *function, int line) {
30-
if (err == -30848) {
30+
if (err == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
3131
return err;
3232
}
3333
#ifdef MBEDTLS_ERROR_C

0 commit comments

Comments
 (0)