From eaa1b76227010bbf4b4a0ad1fdd5eee66ba9e754 Mon Sep 17 00:00:00 2001 From: "Martine S. Lenders" Date: Thu, 17 Dec 2020 17:25:53 +0100 Subject: [PATCH] tests/emcute: add check for message ID with PUBLISH QoS 0 --- tests/emcute/tests/01-run.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/emcute/tests/01-run.py b/tests/emcute/tests/01-run.py index 4a61c8c881..9414162ed8 100755 --- a/tests/emcute/tests/01-run.py +++ b/tests/emcute/tests/01-run.py @@ -101,6 +101,11 @@ class MQTTSNServer(Automaton): def _check_pkt_qos(self, pkt): qos_types = [mqttsn.PUBLISH, mqttsn.SUBSCRIBE] + # see MQTT-SN 1.2 spec 5.4.12 + if (pkt.type == mqttsn.PUBLISH) and \ + (pkt.qos not in [mqttsn.QOS_1, mqttsn.QOS_2]) and \ + (pkt.mid != 0): + return False return (pkt.type not in qos_types) or (pkt.qos == self._qos_flags) def _get_tid(self, topic_name):