Commit 08353731 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Fix MQTT PUB{ACK,REC,REL,COMP} and UNSUBACK flags

Flags should be 0 for all of these, except PUBREL (flags = 2).

PUBLISHED_FROM=46bf63fe12020d4cb493e52ceb3bae0291484b40
parent 16700244
...@@ -9933,8 +9933,9 @@ void mg_mqtt_connack(struct mg_connection *nc, uint8_t return_code) { ...@@ -9933,8 +9933,9 @@ void mg_mqtt_connack(struct mg_connection *nc, uint8_t return_code) {
static void mg_send_mqtt_short_command(struct mg_connection *nc, uint8_t cmd, static void mg_send_mqtt_short_command(struct mg_connection *nc, uint8_t cmd,
uint16_t message_id) { uint16_t message_id) {
uint16_t message_id_net = htons(message_id); uint16_t message_id_net = htons(message_id);
uint8_t flags = (cmd == MG_MQTT_CMD_PUBREL ? 2 : 0);
mg_send(nc, &message_id_net, 2); mg_send(nc, &message_id_net, 2);
mg_mqtt_prepend_header(nc, cmd, MG_MQTT_QOS(1), 2); mg_mqtt_prepend_header(nc, cmd, flags, 2 /* len */);
} }
void mg_mqtt_puback(struct mg_connection *nc, uint16_t message_id) { void mg_mqtt_puback(struct mg_connection *nc, uint16_t message_id) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment