Skip to content

Commit

Permalink
Merge remote-tracking branch 'sprior/master' into dev-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hmueller01 committed Mar 10, 2024
2 parents 71f97c0 + e32c86c commit 5f79424
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 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()) {
yield();
unsigned long t = millis();
if (t-lastInActivity >= ((int32_t) this->socketTimeout*1000UL)) {
_state = MQTT_CONNECTION_TIMEOUT;
Expand Down Expand Up @@ -588,6 +589,7 @@ boolean PubSubClient::write(uint8_t header, uint8_t* buf, uint16_t length) {
uint16_t bytesToWrite;
boolean result = true;
while((bytesRemaining > 0) && result) {
yield();
bytesToWrite = (bytesRemaining > MQTT_MAX_TRANSFER_SIZE)?MQTT_MAX_TRANSFER_SIZE:bytesRemaining;
rc = _client->write(writeBuf,bytesToWrite);
result = (rc == bytesToWrite);
Expand Down

0 comments on commit 5f79424

Please sign in to comment.