From 26813399c41ad33483e52dff977f51c9a352c630 Mon Sep 17 00:00:00 2001 From: "Rafael G. Nagel" Date: Thu, 25 Jan 2024 22:34:29 -0300 Subject: [PATCH 1/2] increment number_of_keep_alives --- src/mqtt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mqtt.c b/src/mqtt.c index d914c1a..842114a 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -620,6 +620,7 @@ ssize_t __mqtt_send(struct mqtt_client *client) case MQTT_CONTROL_SUBSCRIBE: case MQTT_CONTROL_UNSUBSCRIBE: case MQTT_CONTROL_PINGREQ: + client->number_of_keep_alives += 1; msg->state = MQTT_QUEUED_AWAITING_ACK; break; default: From 2bef1024b80f55a0dd1be7920379ba0533c07e34 Mon Sep 17 00:00:00 2001 From: "Rafael G. Nagel" Date: Thu, 25 Jan 2024 22:41:00 -0300 Subject: [PATCH 2/2] fix: increment only for MQTT_CONTROL_PINGREQ --- src/mqtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mqtt.c b/src/mqtt.c index 842114a..dd17a65 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -614,13 +614,13 @@ ssize_t __mqtt_send(struct mqtt_client *client) msg->state = MQTT_QUEUED_AWAITING_ACK; } break; + case MQTT_CONTROL_PINGREQ: + client->number_of_keep_alives += 1; case MQTT_CONTROL_CONNECT: case MQTT_CONTROL_PUBREC: case MQTT_CONTROL_PUBREL: case MQTT_CONTROL_SUBSCRIBE: case MQTT_CONTROL_UNSUBSCRIBE: - case MQTT_CONTROL_PINGREQ: - client->number_of_keep_alives += 1; msg->state = MQTT_QUEUED_AWAITING_ACK; break; default: