Fixes for clients that disconnect very quickly.

This commit is contained in:
Roger A. Light 2014-07-01 22:16:53 +01:00
parent fd9496433c
commit 1257fd49eb
2 changed files with 4 additions and 2 deletions

View File

@ -936,7 +936,7 @@ int mosquitto_loop_forever(struct mosquitto *mosq, int timeout, int max_packets)
if (reconnects !=0 && rc == MOSQ_ERR_SUCCESS){ if (reconnects !=0 && rc == MOSQ_ERR_SUCCESS){
reconnects = 0; reconnects = 0;
} }
}while(rc == MOSQ_ERR_SUCCESS); }while(run && rc == MOSQ_ERR_SUCCESS);
if(errno == EPROTO){ if(errno == EPROTO){
return rc; return rc;
} }

View File

@ -43,7 +43,9 @@ int _mosquitto_handle_connack(struct mosquitto *mosq)
pthread_mutex_unlock(&mosq->callback_mutex); pthread_mutex_unlock(&mosq->callback_mutex);
switch(result){ switch(result){
case 0: case 0:
mosq->state = mosq_cs_connected; if(mosq->state != mosq_cs_disconnecting){
mosq->state = mosq_cs_connected;
}
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;
case 1: case 1:
case 2: case 2: