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

If CONNACK packet's state code is non-zero,loop will not stop and try to reconnect many a time #518

Open
Noskthing opened this issue Aug 15, 2017 · 2 comments

Comments

@Noskthing
Copy link

Noskthing commented Aug 15, 2017

Today i want to test password is wrong this case and find that client always try to reconnect.
In read_handle_client.c

switch(result){
		case 0:
			mosq->state = mosq_cs_connected;
			return MOSQ_ERR_SUCCESS;
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			return MOSQ_ERR_CONN_REFUSED;
		default:
			return MOSQ_ERR_PROTOCOL;
	}

If result is non-zero we don't modify mosq->state. In mosquitto_loop_forever mosquitto will call mosquitto_reconnect many a time to reconnect.

Should we modify mosq->state if CONNECT fail?

@imZack
Copy link
Contributor

imZack commented Aug 15, 2017

What version do you have this issue?

@Noskthing
Copy link
Author

In Last version mosquitto_loop_forever will check mosquitto_loop return value. The loop will quit if error is fatal. But MOSQ_ERR_CONN_REFUSED is not deemed to a fatal error, loop will continue and reconnect again.

What i want to ask is should client stop reconnect server and quit loop if CONNECT fail.

Thanks advance :)

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

2 participants