From c9d604ed02aff0fa40aa5f4dc5e3029986eb551d Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Mon, 13 Aug 2018 16:49:53 +0800 Subject: [PATCH] Fix the badmatch error of packet_to_msg/1 --- src/emqx_client.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/emqx_client.erl b/src/emqx_client.erl index 8c742fbfd..695b9d10c 100644 --- a/src/emqx_client.erl +++ b/src/emqx_client.erl @@ -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}.