From 0e89bb2f0ca8d476dbf10177908a4a9eb5095532 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 13 Jul 2014 14:28:24 +0100 Subject: [PATCH] Fix bug #1324411 Thanks to chenzhenianqing. --- ChangeLog.txt | 2 ++ src/database.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 53725b52..bf07cb2a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -18,6 +18,8 @@ Broker: - When a durable client reconnects, its queued messages are now checked against ACLs in case of a change in username/ACL state since it last connected. +- Fix bug #1324411, which could have had unexpected consequences for delayed + messages in rare circumstances. - Anonymous clients are no longer accidently disconnected from the broker after a SIGHUP. diff --git a/src/database.c b/src/database.c index da3b1c81..efe77836 100644 --- a/src/database.c +++ b/src/database.c @@ -621,7 +621,7 @@ int mqtt3_db_message_timeout_check(struct mosquitto_db *db, unsigned int timeout { int i; time_t threshold; - enum mosquitto_msg_state new_state = mosq_ms_invalid; + enum mosquitto_msg_state new_state; struct mosquitto *context; struct mosquitto_client_msg *msg; @@ -633,6 +633,7 @@ int mqtt3_db_message_timeout_check(struct mosquitto_db *db, unsigned int timeout msg = context->msgs; while(msg){ + new_state = mosq_ms_invalid; if(msg->timestamp < threshold && msg->state != mosq_ms_queued){ switch(msg->state){ case mosq_ms_wait_for_puback: