Skip to content

Commit

Permalink
Fix MQTT PUB{ACK,REC,REL,COMP} and UNSUBACK flags
Browse files Browse the repository at this point in the history
Flags should be 0 for all of these, except PUBREL (flags = 2).

PUBLISHED_FROM=46bf63fe12020d4cb493e52ceb3bae0291484b40
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Mar 8, 2017
1 parent 3e06651 commit 4b63e29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mongoose/mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
uint16_t 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_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) {
Expand Down

0 comments on commit 4b63e29

Please sign in to comment.