Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mosquitto_reconnect_delay_set() does not work according to specification #2759

Open
karmagda opened this issue Feb 24, 2023 · 0 comments
Open

Comments

@karmagda
Copy link

Hello,
I noticed that reconnect back-off mechanism configured via mosquitto_reconnect_delay_set() does not work as stated in documentation.

According to documentation for: delay=3, delay_max=30, exponential_backoff=True
Delays would be: 3, 6, 12, 24, 30, 30, ...

But the tested behavior is different and for: delay=3, delay_max=30, exponential_backoff=True
Delays are: 3, 12, 27, 30, 30, ...

I noticed that the following formula is used for back-off calculation:
if(mosq->reconnect_exponential_backoff){
reconnect_delay = mosq->reconnect_delay*(mosq->reconnects+1)(mosq->reconnects+1);
}else{
reconnect_delay = mosq->reconnect_delay
(mosq->reconnects+1);
}

Shouldn't the formula for the case when exponential_backoff=True look like that:
reconnect_delay = mosq->reconnect_delay*2^(mosq->reconnects-1)

I use mosquitto-1.6.7 but it seems that the same formula is stated in the newest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant