diff --git a/lib/mqtt_protocol.h b/lib/mqtt_protocol.h index 74cfe915..93c7b3e1 100644 --- a/lib/mqtt_protocol.h +++ b/lib/mqtt_protocol.h @@ -22,10 +22,9 @@ Contributors: #define PROTOCOL_NAME_v31 "MQIsdp" #define PROTOCOL_VERSION_v31 3 -#define PROTOCOL_NAME_v311 "MQTT" -#define PROTOCOL_VERSION_v311 4 +#define PROTOCOL_NAME "MQTT" -#define PROTOCOL_NAME_v5 "MQTT" +#define PROTOCOL_VERSION_v311 4 #define PROTOCOL_VERSION_v5 5 diff --git a/lib/send_connect.c b/lib/send_connect.c index 59802c9b..ef83a143 100644 --- a/lib/send_connect.c +++ b/lib/send_connect.c @@ -99,7 +99,7 @@ int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session if(version == MQTT_PROTOCOL_V31){ packet__write_string(packet, PROTOCOL_NAME_v31, strlen(PROTOCOL_NAME_v31)); }else if(version == MQTT_PROTOCOL_V311){ - packet__write_string(packet, PROTOCOL_NAME_v311, strlen(PROTOCOL_NAME_v311)); + packet__write_string(packet, PROTOCOL_NAME, strlen(PROTOCOL_NAME)); } #if defined(WITH_BROKER) && defined(WITH_BRIDGE) if(mosq->bridge && mosq->bridge->try_private && mosq->bridge->try_private_accepted){ diff --git a/src/handle_connect.c b/src/handle_connect.c index c3e747b3..55310459 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -182,7 +182,7 @@ int handle__connect(struct mosquitto_db *db, struct mosquitto *context) goto handle_connect_error; } context->protocol = mosq_p_mqtt31; - }else if(!strcmp(protocol_name, PROTOCOL_NAME_v311)){ + }else if(!strcmp(protocol_name, PROTOCOL_NAME)){ if((protocol_version&0x7F) != PROTOCOL_VERSION_v311){ if(db->config->connection_messages == true){ log__printf(NULL, MOSQ_LOG_INFO, "Invalid protocol version %d in CONNECT from %s.",