Skip to content

Commit a6922dc

Browse files
committed
WiFiClientSecure: don't decrypt when testing for 'connected'
1 parent e4043e9 commit a6922dc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libraries/ESP8266WiFi/src/WiFiClientSecure.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ class SSLContext
193193
return cb;
194194
}
195195

196+
// similar to availble, but doesn't return exact size
197+
bool hasData()
198+
{
199+
return _available > 0 || (s_io_ctx && s_io_ctx->getSize() > 0);
200+
}
201+
196202
bool loadObject(int type, Stream& stream, size_t size)
197203
{
198204
std::unique_ptr<uint8_t[]> buf(new uint8_t[size]);
@@ -458,7 +464,7 @@ err x N N
458464
uint8_t WiFiClientSecure::connected()
459465
{
460466
if (_ssl) {
461-
if (_ssl->available()) {
467+
if (_ssl->hasData()) {
462468
return true;
463469
}
464470
if (_client && _client->state() == ESTABLISHED && _ssl->connected()) {

0 commit comments

Comments
 (0)