Skip to content

Commit

Permalink
Fix immediate bridge reload
Browse files Browse the repository at this point in the history
Currently bridge connections will backoff even when set to immediate.
This change makes the first attempt to reconnect happen without wait.

On failure, backoff will apply as usual.

Signed-off-by: Abilio Marques <[email protected]>
  • Loading branch information
abiliojr committed Oct 18, 2023
1 parent 279bd33 commit ecb7c0e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ void bridge__reload(void)
{
int i;
int j;
struct mosquitto *context;

// destroy old bridges that dissappeared
for(i=0;i<db.bridge_count;i++){
Expand Down Expand Up @@ -771,7 +772,8 @@ void bridge__reload(void)
assert(j<db.bridge_count);
db.bridges[j]->will_delay_interval = 0;
bridge__destroy(db.bridges[j]);
bridge__new(db.config->bridges[i]);
context = bridge__new(db.config->bridges[i]);
context->bridge->restart_t = 1; /* force quick restart of bridge */
db.config->bridges[i] = NULL;
}
}
Expand Down

0 comments on commit ecb7c0e

Please sign in to comment.