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_publish_v5 reports success when not connected to broker #2445

Open
SignalWhisperer opened this issue Jan 26, 2022 · 0 comments
Open

Comments

@SignalWhisperer
Copy link

Using the latest release tag, 2.0.14, on Linux, built from source.

When the client calls mosquitto_publish_v5 without an active connection to a broker, MOSQ_ERR_SUCCESS is returned instead of MOSQ_ERR_NO_CONN as per documentation.

Same issue at QoS level 0.

The connection is pending but not yet established (call to mosquitto_connect_async has not completed nor timed out). The check is only on the socket description (comparison with INVALID_SOCKET) rather than checking the actual state of the connection.

The socket is created and is not invalid, but the state is not connected.

Called from here for QoS 0: https://github.com/eclipse/mosquitto/blob/master/lib/actions.c#L117
Check for invalid socket: https://github.com/eclipse/mosquitto/blob/master/lib/send_publish.c#L60
Proper check to call (maybe?): https://github.com/eclipse/mosquitto/blob/master/lib/util_mosq.h#L34

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