HBMQTT-2 #comment fixed as published message with QOS=0 don't have packet ID

pull/8/head
Nicolas Jouanin 2015-07-01 21:38:22 +02:00
rodzic a7fcdeec93
commit b3e18adefe
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -27,7 +27,11 @@ class PublishVariableHeader(MQTTVariableHeader):
@classmethod
def from_stream(cls, reader: asyncio.StreamReader, fixed_header: MQTTFixedHeader):
topic_name = yield from decode_string(reader)
packet_id = yield from decode_packet_id(reader)
has_qos = (fixed_header.flags >> 1) & 0x03
if has_qos:
packet_id = yield from decode_packet_id(reader)
else:
packet_id = None
return cls(topic_name, packet_id)