Commit 0c3837fa authored by Ian Craggs's avatar Ian Craggs

Deliver QoS message on receipt of Publish rather than Pubrel for MQTT5 #476

parent f5fc716a
...@@ -316,6 +316,11 @@ int MQTTProtocol_handlePublishes(void* pack, int sock) ...@@ -316,6 +316,11 @@ int MQTTProtocol_handlePublishes(void* pack, int sock)
} else } else
ListAppend(client->inboundMsgs, m, sizeof(Messages) + len); ListAppend(client->inboundMsgs, m, sizeof(Messages) + len);
rc = MQTTPacket_send_pubrec(publish->msgId, &client->net, client->clientID); rc = MQTTPacket_send_pubrec(publish->msgId, &client->net, client->clientID);
if (m->MQTTVersion >= MQTTVERSION_5)
{
publish->payload = m->publish->payload;
Protocol_processPublication(publish, client);
}
publish->topic = NULL; publish->topic = NULL;
} }
MQTTPacket_freePublish(publish); MQTTPacket_freePublish(publish);
...@@ -470,7 +475,8 @@ int MQTTProtocol_handlePubrels(void* pack, int sock) ...@@ -470,7 +475,8 @@ int MQTTProtocol_handlePubrels(void* pack, int sock)
publish.MQTTVersion = m->MQTTVersion; publish.MQTTVersion = m->MQTTVersion;
if (publish.MQTTVersion >= MQTTVERSION_5) if (publish.MQTTVersion >= MQTTVERSION_5)
publish.properties = m->properties; publish.properties = m->properties;
Protocol_processPublication(&publish, client); else
Protocol_processPublication(&publish, client); /* only for 3.1.1 and lower */
#if !defined(NO_PERSISTENCE) #if !defined(NO_PERSISTENCE)
rc += MQTTPersistence_remove(client, PERSISTENCE_PUBLISH_RECEIVED, m->qos, pubrel->msgId); rc += MQTTPersistence_remove(client, PERSISTENCE_PUBLISH_RECEIVED, m->qos, pubrel->msgId);
#endif #endif
......
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