1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-06 05:21:22 +03:00

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.
This commit is contained in:
Earle F. Philhower, III 2018-05-22 11:04:32 -07:00 committed by GitHub
parent a1a9b99af6
commit 9b5f3c2882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,10 +228,8 @@ bool WiFiClientSecure::_clientConnected() {
}
uint8_t WiFiClientSecure::connected() {
if (_recvapp_len) {
return true;
}
if (_client && _client->state() == ESTABLISHED && _handshake_done) {
if (WiFiClient::connected() || available() ||
(_clientConnected() && _handshake_done)) {
return true;
}
return false;