bridge: track backoff in ms

Signed-off-by: Abilio Marques <abiliojr@gmail.com>
pull/2422/head
Abilio Marques 4 years ago
parent 03ad07f121
commit 08da33c128

@ -1005,15 +1005,15 @@ void bridge_check(void)
/* Want to try to restart the bridge connection */ /* Want to try to restart the bridge connection */
if(!context->bridge->restart_t){ if(!context->bridge->restart_t){
bridge__update_backoff(context->bridge); bridge__update_backoff(context->bridge);
context->bridge->restart_t = db.now_s+context->bridge->restart_timeout; context->bridge->restart_t = 1000*db.now_s+context->bridge->restart_timeout;
context->bridge->cur_address++; context->bridge->cur_address++;
if(context->bridge->cur_address == context->bridge->address_count){ if(context->bridge->cur_address == context->bridge->address_count){
context->bridge->cur_address = 0; context->bridge->cur_address = 0;
} }
loop__update_next_event(context->bridge->restart_timeout*1000); loop__update_next_event(context->bridge->restart_timeout);
}else{ }else{
if((context->bridge->start_type == bst_lazy && context->bridge->lazy_reconnect) if((context->bridge->start_type == bst_lazy && context->bridge->lazy_reconnect)
|| (context->bridge->start_type == bst_automatic && db.now_s >= context->bridge->restart_t)){ || (context->bridge->start_type == bst_automatic && 1000*db.now_s >= context->bridge->restart_t)){
#if defined(__GLIBC__) && defined(WITH_ADNS) #if defined(__GLIBC__) && defined(WITH_ADNS)
if(context->adns){ if(context->adns){

@ -2172,6 +2172,9 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
} }
} }
} }
cur_bridge->restart_timeout *= 1000; /* backoff is tracked in ms */
cur_bridge->backoff_base *= 1000;
cur_bridge->backoff_cap *= 1000;
#else #else
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available."); log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available.");
#endif #endif

Loading…
Cancel
Save