Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not share CONNECT variable header #186

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions adafruit_minimqtt/adafruit_minimqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@

MQTT_PKT_TYPE_MASK = const(0xF0)

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


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

# NOTE: Variable header is
# MQTT_HDR_CONNECT = bytearray(b"\x04MQTT\x04\x02\0\0")
# because final 4 bytes are 4, 2, 0, 0
var_header = MQTT_HDR_CONNECT
# Variable CONNECT header [MQTT 3.1.2]
# The byte array is used as a template.
var_header = bytearray(b"\x04MQTT\x04\x02\0\0")
var_header[6] = clean_session << 1

# Set up variable header and remaining_length
Expand Down