Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
mosquitto_reconnect_delay_set() not delaying reconnect attemtps #1027
steps to reproduce
Before connecting I set:
I connect to an mqtt server which is up, but intentionally with incorrect credentials, so the connection fails with on_connect callback result = 5.
I run mosquitto with
The reconnection attempts should be slower and slower.
I see reconnection attempts happen every 6-7s, and that time does not increase. not when exponential is true, nor when false.
See logging, connection attemps are evenly spaced in time.
ii libmosquitto-dev:amd64 1.5.3-0mosquitto1~xenial
On ubuntu 16.04 LTS.
When looking at the source code (lib/loop.c) It seems obvious that the case where reconnect_exponential_backoff is false does not work. Nowhere in the code path is reconnect_delay increased, ever.
For the case when reconnect_exponential_backoff is true, its not clear to me why it doesn't work. It seems that somehow
Note that in my case the TCP connection to the mqtt server succeeds, the connection fails due to an code 5 (incorrect credentials (intentional))