Skip to content

Commit

Permalink
available() shouldn't return 0 if there is still data to read. fixed …
Browse files Browse the repository at this point in the history
…logic to include correctly include peeked byte in available count
  • Loading branch information
rdowning-triax committed Dec 3, 2018
1 parent a9779a8 commit c6fb71a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions libraries/WiFiClientSecure/src/WiFiClientSecure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,15 @@ int WiFiClientSecure::read(uint8_t *buf, size_t size)

int WiFiClientSecure::available()
{
if (!_connected) {
return 0;
int res = 0;
if (_connected) {
res = data_to_read(sslclient);
if (res < 0 ) {
stop();
res = 0;
}
}
int res = data_to_read(sslclient);
if (res < 0 ) {
stop();
} else if(_peek >= 0) {
if(_peek >= 0) {
res += 1;
}
return res;
Expand Down

0 comments on commit c6fb71a

Please sign in to comment.