Skip to content

Commit

Permalink
Fix bridges being expired after being restored.
Browse files Browse the repository at this point in the history
This occurred with non-matching cleansession/local_cleansession being
expired on start after restoring from persistence.

Closes #2634. Thanks to everyone on the issue.
  • Loading branch information
ralight committed Apr 8, 2023
1 parent 3b2f3c6 commit 6d240a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.txt
Expand Up @@ -7,6 +7,8 @@ Broker:
assertions removed. Closes #2708.
- Fix default settings incorrectly allowing TLS v1.1. Closes #2722.
- Use line buffered mode for stdout. Closes #2354. Closes #2749.
- Fix bridges with non-matching cleansession/local_cleansession being expired
on start after restoring from persistence. Closes #2634.
- Fix connections being limited to 2048 on Windows. The limit is now 8192,
where supported. Closes #2732.

Expand Down
9 changes: 6 additions & 3 deletions src/persist_write.c
Expand Up @@ -167,11 +167,14 @@ 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 &&
#ifdef WITH_BRIDGE
|| (context->bridge && context->bridge->clean_start_local == false)
((!context->bridge && context->clean_start == false)
|| (context->bridge && context->bridge->clean_start_local == false))
#else
context->clean_start == 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 6d240a9

Please sign in to comment.