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
4 changes: 2 additions & 2 deletions src/PubSubClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ boolean PubSubClient::connect(const char *id, const char *user, const char *pass
lastInActivity = lastOutActivity = millis();

while (!_client->available()) {
delay(10);
unsigned long t = millis();
if (t-lastInActivity >= ((int32_t) this->socketTimeout*1000UL)) {
_state = MQTT_CONNECTION_TIMEOUT;
Expand Down Expand Up @@ -288,7 +289,7 @@ boolean PubSubClient::connect(const char *id, const char *user, const char *pass
boolean PubSubClient::readByte(uint8_t * result) {
uint32_t previousMillis = millis();
while(!_client->available()) {
yield();
delay(10);
uint32_t currentMillis = millis();
if(currentMillis - previousMillis >= ((int32_t) this->socketTimeout * 1000)){
return false;
Expand Down Expand Up @@ -561,7 +562,6 @@ size_t PubSubClient::buildHeader(uint8_t header, uint8_t* buf, uint16_t length)
uint8_t pos = 0;
uint16_t len = length;
do {

digit = len & 127; //digit = len %128
len >>= 7; //len = len / 128
if (len > 0) {
Expand Down