Fix `max_keepalive` option not applying to keepalive=0.

Closes #2117. Thanks to David Nadlinger.
pull/2166/head
Roger A. Light 5 years ago
parent 1109f53fbf
commit 891be8c2fe

@ -22,6 +22,8 @@ Broker:
- Fix bridge increasing backoff calculation.
- Improve handling of invalid combinations of listener address and bind
interface configurations. Closes #2081.
- Fix `max_keepalive` option not applying to clients connecting with keepalive
set to 0. Closes #2117.
Client library:
- Fix encrypted connections incorrectly connecting when the CA file passed to

@ -244,7 +244,9 @@ int connect__on_authorised(struct mosquitto *context, void *auth_data_out, uint1
goto error;
}
}
if(context->keepalive > db.config->max_keepalive){
if(db.config->max_keepalive &&
(context->keepalive > db.config->max_keepalive || context->keepalive == 0)){
context->keepalive = db.config->max_keepalive;
if(mosquitto_property_add_int16(&connack_props, MQTT_PROP_SERVER_KEEP_ALIVE, context->keepalive)){
rc = MOSQ_ERR_NOMEM;

Loading…
Cancel
Save