From 94d61305fa373466bd96b7810b0789952a3cbc3a Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 9 Nov 2021 13:53:37 +0000 Subject: [PATCH] Fix bridge not respecting receive-maximum when reconnecting with MQTT v5. --- ChangeLog.txt | 6 ++++++ src/handle_connack.c | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4a561680..51f94aad 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,9 @@ +2.0.14 - 2021-xx-xx +=================== + +Broker: +- Fix bridge not respecting receive-maximum when reconnecting with MQTT v5. + 2.0.13 - 2021-10-27 =================== diff --git a/src/handle_connack.c b/src/handle_connack.c index 18e40fb8..f4251fe9 100644 --- a/src/handle_connack.c +++ b/src/handle_connack.c @@ -37,6 +37,7 @@ int handle__connack(struct mosquitto *context) uint32_t maximum_packet_size; uint8_t retain_available; uint16_t server_keepalive; + uint16_t inflight_maximum; uint8_t max_qos = 255; if(context == NULL){ @@ -83,9 +84,12 @@ int handle__connack(struct mosquitto *context) } /* receive-maximum */ - mosquitto_property_read_int16(properties, MQTT_PROP_RECEIVE_MAXIMUM, - &context->msgs_out.inflight_maximum, false); - context->msgs_out.inflight_quota = context->msgs_out.inflight_maximum; + inflight_maximum = context->msgs_out.inflight_maximum; + mosquitto_property_read_int16(properties, MQTT_PROP_RECEIVE_MAXIMUM, &inflight_maximum, false); + if(context->msgs_out.inflight_maximum != inflight_maximum){ + context->msgs_out.inflight_maximum = inflight_maximum; + db__message_reconnect_reset(context); + } /* retain-available */ if(mosquitto_property_read_byte(properties, MQTT_PROP_RETAIN_AVAILABLE,