Skip to content

Commit 46d65e3

Browse files
authored
Merge pull request #68 from mazgch/master
Allow other task to run while waiting
2 parents f3fb2ff + a7e69d8 commit 46d65e3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/MqttClient.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ int MqttClient::endMessage()
230230
return 0;
231231
}
232232
}
233+
yield();
233234
}
234235

235236
// reply with PUBREL
@@ -245,6 +246,7 @@ int MqttClient::endMessage()
245246
if (_returnCode != -1) {
246247
return (_returnCode == 0);
247248
}
249+
yield();
248250
}
249251

250252
return 0;
@@ -348,6 +350,7 @@ int MqttClient::subscribe(const char* topic, uint8_t qos)
348350

349351
return (_returnCode >= 0 && _returnCode <= 2);
350352
}
353+
yield();
351354
}
352355

353356
stop();
@@ -391,6 +394,7 @@ int MqttClient::unsubscribe(const char* topic)
391394
if (_returnCode != -1) {
392395
return (_returnCode == 0);
393396
}
397+
yield();
394398
}
395399

396400
stop();
@@ -919,6 +923,7 @@ int MqttClient::connect(IPAddress ip, const char* host, uint16_t port)
919923
if (_returnCode != MQTT_CONNECTION_TIMEOUT) {
920924
break;
921925
}
926+
yield();
922927
}
923928

924929
_connectError = _returnCode;

0 commit comments

Comments
 (0)