From ca4b23486b8916362f0e75616ddcf4be29d7ac49 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 1 Dec 2020 16:08:05 +0000 Subject: [PATCH] Bridges now obey MQTT v5 server-keepalive. --- ChangeLog.txt | 1 + src/handle_connack.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index c73973f5..3911485b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -96,6 +96,7 @@ Broker: - Report an error if the config file is set to a directory. Closes #1814. - Fix bridges incorrectly setting Wills to manage remote notifications when `notifications_local_only` was set true. Closes #1902. +- Bridges now obey MQTT v5 server-keepalive. Client library: - Client no longer generates random client ids for v3.1.1 clients, these are diff --git a/src/handle_connack.c b/src/handle_connack.c index 599ca3e3..a1bb8967 100644 --- a/src/handle_connack.c +++ b/src/handle_connack.c @@ -34,6 +34,7 @@ int handle__connack(struct mosquitto *context) mosquitto_property *properties = NULL; uint32_t maximum_packet_size; uint8_t retain_available; + uint16_t server_keepalive; if(!context){ return MOSQ_ERR_INVAL; @@ -77,6 +78,13 @@ int handle__connack(struct mosquitto *context) } } + /* server-keepalive */ + if(mosquitto_property_read_int16(properties, MQTT_PROP_SERVER_KEEP_ALIVE, + &server_keepalive, false)){ + + context->keepalive = server_keepalive; + } + mosquitto_property_free_all(&properties); } mosquitto_property_free_all(&properties); /* FIXME - TEMPORARY UNTIL PROPERTIES PROCESSED */