From 81a82f6fe28ef85344f732f5e386846fdbcf0ede Mon Sep 17 00:00:00 2001 From: Dave Miller Date: Mon, 23 Jul 2018 14:27:57 -0500 Subject: [PATCH] Fix for issue #874 With special acknowledgement to sxsing (his github login) for his help in development and testing of this fix. NOTE: Pull-request is against master as the fixes branch has not been updated with the v1.5 file src/handle_connect.c Signed-off-by: Dave Miller --- src/handle_connect.c | 1 + src/loop.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/handle_connect.c b/src/handle_connect.c index 4246af16..a510df77 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -578,6 +578,7 @@ int handle__connect(struct mosquitto_db *db, struct mosquitto *context) } found_context->clean_session = true; + found_context->state = mosq_cs_expiring; do_disconnect(db, found_context); } diff --git a/src/loop.c b/src/loop.c index 507b81be..1c7b4d2e 100644 --- a/src/loop.c +++ b/src/loop.c @@ -608,7 +608,9 @@ void do_disconnect(struct mosquitto_db *db, struct mosquitto *context) }else{ id = ""; } - if(context->state != mosq_cs_disconnecting){ + if (context->state == mosq_cs_expiring){ + log__printf(NULL, MOSQ_LOG_NOTICE, "Expiring old client session %s, disconnecting.", id); + }else if(context->state != mosq_cs_disconnecting){ log__printf(NULL, MOSQ_LOG_NOTICE, "Socket error on client %s, disconnecting.", id); }else{ log__printf(NULL, MOSQ_LOG_NOTICE, "Client %s disconnected.", id);