From f952ae3a672cfc7f7d97f1a37e049e2a25d37d68 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 3 Feb 2019 22:26:10 +0000 Subject: [PATCH] Fixed durable clients being unable to receive messages when offline. This occurred when per_listener_settings was set to true. Closes #1081. Thanks to dwin-wangjt. --- ChangeLog.txt | 2 ++ lib/net_mosq.c | 2 -- lib/util_mosq.c | 5 ----- man/mosquitto.conf.5.xml | 4 ++++ mosquitto.conf | 4 ++++ 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f4a9ddcf..7785799e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -34,6 +34,8 @@ Broker: #1080. - Fix Will not being sent for Websockets clients. Closes #1143. - Windows: Fix possible crash when client disconnects. Closes #1137. +- Fixed durable clients being unable to receive messages when offline, when + per_listener_settings was set to true. Closes #1081. Library: - Fix TLS connections not working over SOCKS. diff --git a/lib/net_mosq.c b/lib/net_mosq.c index c7de615a..ed783cad 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -174,8 +174,6 @@ int net__socket_close(struct mosquitto *mosq) #ifdef WITH_BROKER if(mosq->listener){ mosq->listener->client_count--; - assert(mosq->listener->client_count >= 0); - mosq->listener = NULL; } #endif diff --git a/lib/util_mosq.c b/lib/util_mosq.c index 350d1ccc..4caed72b 100644 --- a/lib/util_mosq.c +++ b/lib/util_mosq.c @@ -89,11 +89,6 @@ int mosquitto__check_keepalive(struct mosquitto *mosq) pthread_mutex_unlock(&mosq->msgtime_mutex); }else{ #ifdef WITH_BROKER - if(mosq->listener){ - mosq->listener->client_count--; - assert(mosq->listener->client_count >= 0); - } - mosq->listener = NULL; net__socket_close(db, mosq); #else net__socket_close(mosq); diff --git a/man/mosquitto.conf.5.xml b/man/mosquitto.conf.5.xml index 9f164f16..60337bf9 100644 --- a/man/mosquitto.conf.5.xml +++ b/man/mosquitto.conf.5.xml @@ -535,6 +535,10 @@ , , . + Note that if set to true, then a durable client (i.e. + with clean session set to false) that has disconnected + will use the ACL settings defined for the listener that + it was most recently connected to. The default behaviour is for this to be set to false, which maintains the settings behaviour from previous versions of diff --git a/mosquitto.conf b/mosquitto.conf index e8c43397..d0ec0df7 100644 --- a/mosquitto.conf +++ b/mosquitto.conf @@ -144,6 +144,10 @@ # password_file acl_file psk_file auth_plugin auth_opt_* allow_anonymous # auto_id_prefix allow_zero_length_clientid # +# Note that if set to true, then a durable client (i.e. with clean session set +# to false) that has disconnected will use the ACL settings defined for the +# listener that it was most recently connected to. +# # The default behaviour is for this to be set to false, which maintains the # setting behaviour from previous versions of mosquitto. #per_listener_settings false