Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/PubSubClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ boolean PubSubClient::connect(const char *id, const char *user, const char *pass

// reads a byte into result
boolean PubSubClient::readByte(uint8_t * result) {
int rc;
uint32_t previousMillis = millis();
while(!_client->available()) {
yield();
Expand All @@ -294,8 +295,13 @@ boolean PubSubClient::readByte(uint8_t * result) {
return false;
}
}
*result = _client->read();
return true;
rc = _client->read();
if(rc >= 0) {
rxCount++;
*result = rc;
return true;
}
return false;
}

// reads a byte into result[*index] and increments index
Expand Down