From ca110fa645b7cfed5d70f4153a19a5a4b26ebd84 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 19 Jun 2017 21:31:09 -0300 Subject: [PATCH] MQTT ignores too many handlers registered On MQTTClient.c function mqtt_subscribe, if more than MQTT_MAX_MESSAGE_HANDLERS are registered, the variable rc receives the value of grantedQoS. If grantedQoS = 0, and all handlers are already occupied, it goes on and returns 0 to the caller. --- extras/paho_mqtt_c/MQTTClient.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/paho_mqtt_c/MQTTClient.c b/extras/paho_mqtt_c/MQTTClient.c index e8209ea..c2419c3 100644 --- a/extras/paho_mqtt_c/MQTTClient.c +++ b/extras/paho_mqtt_c/MQTTClient.c @@ -424,6 +424,8 @@ int mqtt_subscribe(mqtt_client_t* c, const char* topic, enum mqtt_qos qos, mqtt if (rc != 0x80) { int i; + + rc = MQTT_FAILURE; for (i = 0; i < MQTT_MAX_MESSAGE_HANDLERS; ++i) { if (c->messageHandlers[i].topicFilter == 0)