Skip to content

Commit 9b5f3c2

Browse files
Report connected when any bytes are available (#4754)
The SSL pipeline is multi-stage, and the TCP connection can go down even though there is still data waiting to be decrypted or in the decryption buffer. Explicitly check that there if there can be any data made available to the app, and if so report that we are still connected(). When there is no data and there is no TCP connection, report disconnected.
1 parent a1a9b99 commit 9b5f3c2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,8 @@ bool WiFiClientSecure::_clientConnected() {
228228
}
229229

230230
uint8_t WiFiClientSecure::connected() {
231-
if (_recvapp_len) {
232-
return true;
233-
}
234-
if (_client && _client->state() == ESTABLISHED && _handshake_done) {
231+
if (WiFiClient::connected() || available() ||
232+
(_clientConnected() && _handshake_done)) {
235233
return true;
236234
}
237235
return false;

0 commit comments

Comments
 (0)