Fix the badmatch error of packet_to_msg/1

This commit is contained in:
Feng Lee 2018-08-13 16:49:53 +08:00
parent 9145fb9ec8
commit c9d604ed02
1 changed files with 8 additions and 2 deletions

View File

@ -992,8 +992,14 @@ deliver(#mqtt_msg{qos = QoS, dup = Dup, retain = Retain, packet_id = PacketId,
topic => Topic, properties => Props, payload => Payload}},
State.
packet_to_msg(?PUBLISH_PACKET(Header, Topic, PacketId, Props, Payload)) ->
#mqtt_packet_header{qos = QoS, retain = R, dup = Dup} = Header,
packet_to_msg(#mqtt_packet{header = #mqtt_packet_header{type = ?PUBLISH,
dup = Dup,
qos = QoS,
retain = R},
variable = #mqtt_packet_publish{topic_name = Topic,
packet_id = PacketId,
properties = Props},
payload = Payload}) ->
#mqtt_msg{qos = QoS, retain = R, dup = Dup, packet_id = PacketId,
topic = Topic, props = Props, payload = Payload}.