You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A) Precondition:
Successfully connect from mosquitto to a broker and stop the broker service from the server.
Register a disconnectCallback like "mosquitto_disconnect_callback_set(mosq, disconnectCallback)"
B) Reproduction:
When getting informed about "unexpected disconnect" by disconnectCallback call:
mosquitto_disconnect(mosq);
mosquitto_loop_stop(mosq, false);
Internally mosquitto_loop_stop() does not return before the reconnect_delay expired (which could be a huge time) and is unnecessary to wait.
C) Possible fix in loop.c:
in mosquitto_loop_forever() use from Line 268:
// Regularly check state and stop waiting when disconnecting.
while (reconnect_delay) {
// Sleep for one second
// Stop waiting in case of disconnecting.
pthread_mutex_lock(&mosq->state_mutex);
if (mosq->state == mosq_cs_disconnecting) {
reconnect_delay = 0;
}
pthread_mutex_unlock(&mosq->state_mutex);
}
The text was updated successfully, but these errors were encountered:
A) Precondition:
Successfully connect from mosquitto to a broker and stop the broker service from the server.
Register a disconnectCallback like "mosquitto_disconnect_callback_set(mosq, disconnectCallback)"
B) Reproduction:
When getting informed about "unexpected disconnect" by disconnectCallback call:
Internally mosquitto_loop_stop() does not return before the reconnect_delay expired (which could be a huge time) and is unnecessary to wait.
C) Possible fix in loop.c:
in mosquitto_loop_forever() use from Line 268:
#ifdef WIN32
Sleep(1000);
#else
req.tv_sec = 1;
req.tv_nsec = 0;
while(nanosleep(&req, &rem) == -1 && errno == EINTR){
req = rem;
}
#endif
reconnect_delay--;
The text was updated successfully, but these errors were encountered: