From 161754871f0c77f10840067e60cab9bf3a803050 Mon Sep 17 00:00:00 2001 From: Ery Lee Date: Sun, 11 Jan 2015 23:53:14 +0800 Subject: [PATCH] issue#33: QoS of PUBREL packet should be 1 --- apps/emqtt/src/emqtt_protocol.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/emqtt/src/emqtt_protocol.erl b/apps/emqtt/src/emqtt_protocol.erl index e0eab9001..170234791 100644 --- a/apps/emqtt/src/emqtt_protocol.erl +++ b/apps/emqtt/src/emqtt_protocol.erl @@ -230,9 +230,14 @@ make_packet(Type) when Type >= ?CONNECT andalso Type =< ?DISCONNECT -> #mqtt_packet{ header = #mqtt_packet_header { type = Type } }. make_packet(PubAck, PacketId) when PubAck >= ?PUBACK andalso PubAck =< ?PUBCOMP -> - #mqtt_packet { header = #mqtt_packet_header { type = PubAck}, + #mqtt_packet { header = #mqtt_packet_header { type = PubAck, qos = puback_qos(PubAck) }, variable = #mqtt_packet_puback { packet_id = PacketId}}. +puback_qos(?PUBACK) -> ?QOS_0; +puback_qos(?PUBREC) -> ?QOS_0; +puback_qos(?PUBREL) -> ?QOS_1; +puback_qos(?PUBCOMP) -> ?QOS_0; + -spec send_message(Message, State) -> {ok, NewState} when Message :: mqtt_message(), State :: proto_state(),