mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-24 19:19:00 +08:00
Fix parsing of MQTT QoS > 0 PUBLISH messages
Message ID comes after topic, not before. PUBLISHED_FROM=1ec2a56e290b67061b18c745671dc7f089b9cc0d
This commit is contained in:
parent
49ca223e9c
commit
16700244b0
@ -9667,12 +9667,11 @@ MG_INTERNAL int parse_mqtt(struct mbuf *io, struct mg_mqtt_message *mm) {
|
||||
mm->message_id = getu16(p);
|
||||
break;
|
||||
case MG_MQTT_CMD_PUBLISH: {
|
||||
if (MG_MQTT_GET_QOS(header) > 0) {
|
||||
p = scanto(p, &mm->topic);
|
||||
if (mm->qos > 0) {
|
||||
mm->message_id = getu16(p);
|
||||
p += 2;
|
||||
}
|
||||
p = scanto(p, &mm->topic);
|
||||
|
||||
mm->payload.p = p;
|
||||
mm->payload.len = end - p;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user