issue#33: QoS of PUBREL packet should be 1

This commit is contained in:
Ery Lee 2015-01-11 23:53:14 +08:00
parent 3ca3552452
commit 161754871f
1 changed files with 6 additions and 1 deletions

View File

@ -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(),