Skip to content

Commit

Permalink
Fix bridge queued messages not being persisted.
Browse files Browse the repository at this point in the history
This happens when local_cleansession is set to false and cleansession is
set to true.

Closes #2604. Thank to Frank Dekervel.
  • Loading branch information
ralight committed Aug 13, 2022
1 parent 5d18962 commit fa31b6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ChangeLog.txt
Expand Up @@ -22,6 +22,8 @@ Broker:
security plugin. Closes #2525.
- Fix confusing error message when dynamic security config file was a
directory. Closes #2520.
- Fix bridge queued messages not being persisted when local_cleansession is
set to false and cleansession is set to true. Closes #2604.

Client library:
- Fix threads library detection on Windows under cmake. Bumps the minimum
Expand Down
6 changes: 5 additions & 1 deletion src/persist_write.c
Expand Up @@ -167,7 +167,11 @@ static int persist__client_save(FILE *db_fptr)
memset(&chunk, 0, sizeof(struct P_client));

HASH_ITER(hh_id, db.contexts_by_id, context, ctxt_tmp){
if(context && context->clean_start == false){
if(context && (context->clean_start == false
#ifdef WITH_BRIDGE
|| (context->bridge && context->bridge->clean_start_local == false)
#endif
)){
chunk.F.session_expiry_time = context->session_expiry_time;
if(context->session_expiry_interval != 0 && context->session_expiry_interval != UINT32_MAX && context->session_expiry_time == 0){
chunk.F.session_expiry_time = context->session_expiry_interval + db.now_real_s;
Expand Down

0 comments on commit fa31b6f

Please sign in to comment.