Skip to content

Commit 37af7a7

Browse files
committed
Minor MQTT fix
1 parent c7eb311 commit 37af7a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backends/mqtt.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,11 @@ static int mqtt_reconnect(instance* inst){
314314

315315
//prepare CONNECT message header
316316
variable_header[6] = data->mqtt_version;
317-
variable_header[7] = 0x02 /*clean start*/ | (data->user ? 0x80 : 0x00) | (data->user ? 0x40 : 0x00);
317+
variable_header[7] = 0x02 /*clean start*/ | (data->user ? 0x80 : 0x00) | (data->password ? 0x40 : 0x00);
318318

319319
if(data->mqtt_version == 0x05){ //mqtt v5 has additional options
320320
//push number of option bytes (as a varint, no less) before actually pushing the option data.
321-
//obviously someone thought saving 3 whole bytes in exchange for not being able to sequentially creating the package was smart..
321+
//obviously someone thought saving 3 whole bytes in exchange for not being able to sequentially create the package was smart..
322322
variable_header[vh_offset++] = 8;
323323
//push maximum packet size option
324324
variable_header[vh_offset++] = 0x27;

0 commit comments

Comments
 (0)