only check for suback if using MQTT 3.1.1 or higher
This commit is contained in:
parent
b9c9a28883
commit
e70e2367b6
@ -125,13 +125,16 @@ int8_t Adafruit_MQTT::connect() {
|
|||||||
if (!sendPacket(buffer, len))
|
if (!sendPacket(buffer, len))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Get SUBACK
|
// Check for SUBACK if using MQTT 3.1.1 or higher
|
||||||
len = readPacket(buffer, 5, CONNECT_TIMEOUT_MS);
|
if(MQTT_PROTOCOL_LEVEL > 3) {
|
||||||
DEBUG_PRINT(F("SUBACK:\t"));
|
len = readPacket(buffer, 5, CONNECT_TIMEOUT_MS);
|
||||||
DEBUG_PRINTBUFFER(buffer, len);
|
DEBUG_PRINT(F("SUBACK:\t"));
|
||||||
if ((len != 5) || (buffer[0] != (MQTT_CTRL_SUBACK << 4))) {
|
DEBUG_PRINTBUFFER(buffer, len);
|
||||||
return 6; // failure to subscribe
|
if ((len != 5) || (buffer[0] != (MQTT_CTRL_SUBACK << 4))) {
|
||||||
|
return 6; // failure to subscribe
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user