From 4960fc0702738a4f875e864bdbd200fc4d330412 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 18 Dec 2019 23:24:06 +0000 Subject: [PATCH] Don't disconnect clients that are already disconnected. This prevents the session expiry being extended on SIGHUP. Closes #1521. Thanks to Christoph Krey. --- ChangeLog.txt | 5 +++++ src/context.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 22de95ef..3e56770a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,11 @@ Broker: correctly. Creating a new user with `-b` worked without problem. Closes #1664. - Fix memory leak when connecting clients rejected. +- Don't disconnect clients that are already disconnected. This prevents the + session expiry being extended on SIGHUP. Closes #1521. + + 1.6.8 - 20191128 + ================ Client library: - Don't treat an unexpected PUBACK, PUBREL, or PUBCOMP as a fatal error. diff --git a/src/context.c b/src/context.c index fd9ac17b..32ceca5b 100644 --- a/src/context.c +++ b/src/context.c @@ -226,6 +226,10 @@ void context__send_will(struct mosquitto_db *db, struct mosquitto *ctxt) void context__disconnect(struct mosquitto_db *db, struct mosquitto *context) { + if(mosquitto__get_state(context) == mosq_cs_disconnected){ + return; + } + net__socket_close(db, context); context__send_will(db, context);