Fix bridge queued messages not being persisted.

This happens when local_cleansession is set to false and cleansession is
set to true.

Closes #2604. Thank to Frank Dekervel.
This commit is contained in:
Roger A. Light 2022-08-13 22:46:19 +01:00
parent 5d18962486
commit fa31b6f41d
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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;