kopia lustrzana https://github.com/Yakifo/amqtt
Generate packet ID only for QOS > 0 messages.
rodzic
9adbbdfc3a
commit
afed8acf72
|
@ -97,9 +97,12 @@ class ProtocolHandler:
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def mqtt_publish(self, topic, message, qos, retain):
|
def mqtt_publish(self, topic, message, qos, retain):
|
||||||
packet_id = self.session.next_packet_id
|
if qos:
|
||||||
if packet_id in self.session.outgoing_msg:
|
packet_id = self.session.next_packet_id
|
||||||
self.logger.warn("%s A message with the same packet ID is already in flight" % self.session.client_id)
|
if packet_id in self.session.outgoing_msg:
|
||||||
|
self.logger.warn("%s A message with the same packet ID is already in flight" % self.session.client_id)
|
||||||
|
else:
|
||||||
|
packet_id = None
|
||||||
packet = PublishPacket.build(topic, message, packet_id, False, qos, retain)
|
packet = PublishPacket.build(topic, message, packet_id, False, qos, retain)
|
||||||
yield from self.outgoing_queue.put(packet)
|
yield from self.outgoing_queue.put(packet)
|
||||||
if qos != QOS_0:
|
if qos != QOS_0:
|
||||||
|
|
Ładowanie…
Reference in New Issue