Merge pull request #15661 from haukepetersen/fix_emcute_msgidqos0
net/emcute: fix MsgId for PUBLISH with QOS0
This commit is contained in:
commit
1e7b95cd70
@ -66,6 +66,7 @@
|
|||||||
* how to put / how to encode the IPv(4/6) address AND the port of
|
* how to put / how to encode the IPv(4/6) address AND the port of
|
||||||
* a gateway in the GwAdd field of the GWINFO message
|
* a gateway in the GwAdd field of the GWINFO message
|
||||||
* @todo QOS level 2
|
* @todo QOS level 2
|
||||||
|
* @todo QOS level -1
|
||||||
* @todo put the node to sleep (send DISCONNECT with duration field set)
|
* @todo put the node to sleep (send DISCONNECT with duration field set)
|
||||||
* @todo handle DISCONNECT messages initiated by the broker/gateway
|
* @todo handle DISCONNECT messages initiated by the broker/gateway
|
||||||
* @todo support for pre-defined and short topic IDs
|
* @todo support for pre-defined and short topic IDs
|
||||||
|
|||||||
@ -351,8 +351,15 @@ int emcute_pub(emcute_topic_t *topic, const void *data, size_t len,
|
|||||||
tbuf[pos++] = flags;
|
tbuf[pos++] = flags;
|
||||||
byteorder_htobebufs(&tbuf[pos], topic->id);
|
byteorder_htobebufs(&tbuf[pos], topic->id);
|
||||||
pos += 2;
|
pos += 2;
|
||||||
|
/* set generated MessageId for QOS 1 and 2, else set it to 0 */
|
||||||
|
if (((flags & MQTTSN_QOS_MASK) == MQTTSN_QOS_1) ||
|
||||||
|
((flags & MQTTSN_QOS_MASK) == MQTTSN_QOS_2)) {
|
||||||
byteorder_htobebufs(&tbuf[pos], id_next);
|
byteorder_htobebufs(&tbuf[pos], id_next);
|
||||||
waitonid = id_next++;
|
waitonid = id_next++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
memset(&tbuf[pos], 0, 2);
|
||||||
|
}
|
||||||
pos += 2;
|
pos += 2;
|
||||||
memcpy(&tbuf[pos], data, len);
|
memcpy(&tbuf[pos], data, len);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user