You've already forked Adafruit_MQTT_Library
mirror of
https://github.com/adafruit/Adafruit_MQTT_Library.git
synced 2025-06-13 10:01:31 +03:00
remove broken while loop from ping()
This commit is contained in:
@ -297,19 +297,20 @@ Adafruit_MQTT_Subscribe *Adafruit_MQTT::readSubscription(int16_t timeout) {
|
||||
return subscriptions[i];
|
||||
}
|
||||
|
||||
bool Adafruit_MQTT::ping(uint8_t times) {
|
||||
while (times) {
|
||||
// Construct and send ping packet.
|
||||
uint8_t len = pingPacket(buffer);
|
||||
if (!sendPacket(buffer, len))
|
||||
return false;
|
||||
bool Adafruit_MQTT::ping() {
|
||||
|
||||
// Construct and send ping packet.
|
||||
uint8_t len = pingPacket(buffer);
|
||||
if (!sendPacket(buffer, len))
|
||||
return false;
|
||||
|
||||
// Process ping reply.
|
||||
len = readPacket(buffer, 2, PING_TIMEOUT_MS);
|
||||
if (buffer[0] == (MQTT_CTRL_PINGRESP << 4))
|
||||
return true;
|
||||
|
||||
// Process ping reply.
|
||||
len = readPacket(buffer, 2, PING_TIMEOUT_MS);
|
||||
if (buffer[0] == (MQTT_CTRL_PINGRESP << 4))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// Packet Generation Functions /////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user