Skip to content

Commit

Permalink
WiFiClientSecure: don't decrypt when testing for 'connected'
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Dec 26, 2017
1 parent e4043e9 commit a6922dc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libraries/ESP8266WiFi/src/WiFiClientSecure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ class SSLContext
return cb;
}

// similar to availble, but doesn't return exact size
bool hasData()
{
return _available > 0 || (s_io_ctx && s_io_ctx->getSize() > 0);
}

bool loadObject(int type, Stream& stream, size_t size)
{
std::unique_ptr<uint8_t[]> buf(new uint8_t[size]);
Expand Down Expand Up @@ -458,7 +464,7 @@ err x N N
uint8_t WiFiClientSecure::connected()
{
if (_ssl) {
if (_ssl->available()) {
if (_ssl->hasData()) {
return true;
}
if (_client && _client->state() == ESTABLISHED && _ssl->connected()) {
Expand Down

0 comments on commit a6922dc

Please sign in to comment.