diff --git a/ChangeLog.txt b/ChangeLog.txt index e1dd2f1f..7821e570 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,7 @@ Broker: - Fix TLS operation with websockets listeners and libwebsockts 2.x. Closes #186. - Don't disconnect client on HUP before reading the pending data. Closes #7. +- Fix some $SYS messages being incorrectly persisted. Closes #191. Build: - Don't attempt to install docs when WITH_DOCS=no. Closes #184. diff --git a/src/persist.c b/src/persist.c index d71fc04b..f416aeab 100644 --- a/src/persist.c +++ b/src/persist.c @@ -140,7 +140,7 @@ static int mqtt3_db_message_store_write(struct mosquitto_db *db, FILE *db_fptr) stored = db->msg_store; while(stored){ if(stored->topic && !strncmp(stored->topic, "$SYS", 4)){ - if(stored->ref_count == 1 && stored->dest_id_count == 0){ + if(stored->ref_count <= 1 && stored->dest_id_count == 0){ /* $SYS messages that are only retained shouldn't be persisted. */ stored = stored->next; continue;