-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Pending messages not published when using threading #722
Comments
I was under the impression you had to call stop before disconnect? |
@karlp Not necessary but, lets try it out... I tried many ways of "closing the connection" without success. Overall this is an annoying issue. :( Not publishing all messagesif (mqo.disconnect() != MOSQ_ERR_SUCCESS) {
throw std::runtime_error("could not disconnect from server");
}
if (mqo.loop_stop(true) != MOSQ_ERR_SUCCESS) {
throw std::runtime_error("could not stop loop");
} if (mqo.disconnect() != MOSQ_ERR_SUCCESS) {
throw std::runtime_error("could not disconnect from server");
}
if (mqo.loop_stop(false) != MOSQ_ERR_SUCCESS) {
throw std::runtime_error("could not stop loop");
} Endless hangs but publish all messagesif (mqo.loop_stop(false) != MOSQ_ERR_SUCCESS) { // Hangs here forever
throw std::runtime_error("could not stop loop");
}
if (mqo.disconnect() != MOSQ_ERR_SUCCESS) {
throw std::runtime_error("could not disconnect from server");
} Endless hangs and not publishing all messagesif (mqo.loop_stop(true) != MOSQ_ERR_SUCCESS) { // Hangs here forever
throw std::runtime_error("could not stop loop");
}
if (mqo.disconnect() != MOSQ_ERR_SUCCESS) {
throw std::runtime_error("could not disconnect from server");
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have got a reproducible issue when publishing messages right before the end of a mosquitto connection.
Pending messages will not published after calling
disconnect
orloop_stop()
.We are looking for a functionality to flush all messages before a connection is closed.
Check out the following example.
Only if you uncomment the thread sleep, all messages will be published.
Mosquitto v. 1.4.14
The text was updated successfully, but these errors were encountered: