Skip to content

Commit 4c58026

Browse files
committed
do not share CONNECT variable header
fixes #185
1 parent 926846c commit 4c58026

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@
6666

6767
MQTT_PKT_TYPE_MASK = const(0xF0)
6868

69-
# Variable CONNECT header [MQTT 3.1.2]
70-
MQTT_HDR_CONNECT = bytearray(b"\x04MQTT\x04\x02\0\0")
71-
7269

7370
CONNACK_ERRORS = {
7471
const(0x01): "Connection Refused - Incorrect Protocol Version",
@@ -567,10 +564,9 @@ def _connect(
567564
# Fixed Header
568565
fixed_header = bytearray([0x10])
569566

570-
# NOTE: Variable header is
571-
# MQTT_HDR_CONNECT = bytearray(b"\x04MQTT\x04\x02\0\0")
572-
# because final 4 bytes are 4, 2, 0, 0
573-
var_header = MQTT_HDR_CONNECT
567+
# Variable CONNECT header [MQTT 3.1.2]
568+
# The byte array is used as a template.
569+
var_header = bytearray(b"\x04MQTT\x04\x02\0\0")
574570
var_header[6] = clean_session << 1
575571

576572
# Set up variable header and remaining_length

0 commit comments

Comments
 (0)