|
|
|
@ -316,7 +316,7 @@ def to_string(packet):
|
|
|
|
|
(cmd, rl) = struct.unpack('!BB', packet)
|
|
|
|
|
return "AUTH, rl="+str(rl)
|
|
|
|
|
|
|
|
|
|
def gen_connect(client_id, clean_session=True, keepalive=60, username=None, password=None, will_topic=None, will_qos=0, will_retain=False, will_payload=b"", proto_ver=4, connect_reserved=False, properties=b"", will_properties=b""):
|
|
|
|
|
def gen_connect(client_id, clean_session=True, keepalive=60, username=None, password=None, will_topic=None, will_qos=0, will_retain=False, will_payload=b"", proto_ver=4, connect_reserved=False, properties=b"", will_properties=b"", session_expiry=-1):
|
|
|
|
|
if (proto_ver&0x7F) == 3 or proto_ver == 0:
|
|
|
|
|
remaining_length = 12
|
|
|
|
|
elif (proto_ver&0x7F) == 4 or proto_ver == 5:
|
|
|
|
@ -341,6 +341,10 @@ def gen_connect(client_id, clean_session=True, keepalive=60, username=None, pass
|
|
|
|
|
if proto_ver == 5:
|
|
|
|
|
if properties == b"":
|
|
|
|
|
properties += mqtt5_props.gen_uint16_prop(mqtt5_props.PROP_RECEIVE_MAXIMUM, 20)
|
|
|
|
|
|
|
|
|
|
if session_expiry != -1:
|
|
|
|
|
properties += mqtt5_props.gen_uint32_prop(mqtt5_props.PROP_SESSION_EXPIRY_INTERVAL, session_expiry)
|
|
|
|
|
|
|
|
|
|
properties = mqtt5_props.prop_finalise(properties)
|
|
|
|
|
remaining_length += len(properties)
|
|
|
|
|
|
|
|
|
|