From 3048c5ba0d4922b5eb322a489174d2ce4937e406 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 14 May 2016 21:57:09 +0100 Subject: [PATCH] Changelog update. Fix reconnecting for bridges that use TLS on Windows. Closes #154. Thanks to Dmitry Kaukov. --- ChangeLog.txt | 1 + src/persist.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 0f98bda1..4a978f30 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -12,6 +12,7 @@ Broker: - Fix incorrect $SYS heap memory reporting when using ACLs. - Bridge config parameters couldn't contain a space, this has been fixed. Closes #150. +- Fix reconnecting for bridges that use TLS on Windows. Closes #154. Client library: - Fix the case where a message received just before the keepalive timer diff --git a/src/persist.c b/src/persist.c index 7cf50b6c..176d6e81 100644 --- a/src/persist.c +++ b/src/persist.c @@ -140,6 +140,11 @@ static int mqtt3_db_message_store_write(struct mosquitto_db *db, FILE *db_fptr) stored = db->msg_store; while(stored){ if(!strncmp(stored->topic, "$SYS", 4)){ + if(stored->ref_count == 1 && stored->dest_id_count == 0){ + /* $SYS messages that are only retained shouldn't be persisted. */ + stored = stored->next; + continue; + } /* Don't save $SYS messages as retained otherwise they can give * misleading information when reloaded. They should still be saved * because a disconnected durable client may have them in their