|
|
|
@ -210,7 +210,7 @@ int packet__write(struct mosquitto *mosq)
|
|
|
|
|
{
|
|
|
|
|
ssize_t write_length;
|
|
|
|
|
struct mosquitto__packet *packet;
|
|
|
|
|
int state;
|
|
|
|
|
enum mosquitto_client_state state;
|
|
|
|
|
|
|
|
|
|
if(!mosq) return MOSQ_ERR_INVAL;
|
|
|
|
|
if(mosq->sock == INVALID_SOCKET) return MOSQ_ERR_NO_CONN;
|
|
|
|
@ -228,7 +228,7 @@ int packet__write(struct mosquitto *mosq)
|
|
|
|
|
|
|
|
|
|
state = mosquitto__get_state(mosq);
|
|
|
|
|
#if defined(WITH_TLS) && !defined(WITH_BROKER)
|
|
|
|
|
if((state == mosq_cs_connect_pending) || mosq->want_connect){
|
|
|
|
|
if(state == mosq_cs_connect_pending || mosq->want_connect){
|
|
|
|
|
#else
|
|
|
|
|
if(state == mosq_cs_connect_pending){
|
|
|
|
|
#endif
|
|
|
|
@ -328,7 +328,7 @@ int packet__read(struct mosquitto *mosq)
|
|
|
|
|
uint8_t byte;
|
|
|
|
|
ssize_t read_length;
|
|
|
|
|
int rc = 0;
|
|
|
|
|
int state;
|
|
|
|
|
enum mosquitto_client_state state;
|
|
|
|
|
|
|
|
|
|
if(!mosq){
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -363,7 +363,7 @@ int packet__read(struct mosquitto *mosq)
|
|
|
|
|
#ifdef WITH_BROKER
|
|
|
|
|
G_BYTES_RECEIVED_INC(1);
|
|
|
|
|
/* Clients must send CONNECT as their first command. */
|
|
|
|
|
if(!(mosq->bridge) && mosq->state == mosq_cs_connected && (byte&0xF0) != CMD_CONNECT){
|
|
|
|
|
if(!(mosq->bridge) && state == mosq_cs_connected && (byte&0xF0) != CMD_CONNECT){
|
|
|
|
|
return MOSQ_ERR_PROTOCOL;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|