From 5a3645c97e5f64c33948d76905dea41be5cbff8a Mon Sep 17 00:00:00 2001 From: zhouzb Date: Fri, 6 Sep 2019 14:51:52 +0800 Subject: [PATCH] Remove proto_ver field stored in the headers of message --- src/emqx_channel.erl | 7 ++----- src/emqx_packet.erl | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/emqx_channel.erl b/src/emqx_channel.erl index 1902c232f..aa001cb01 100644 --- a/src/emqx_channel.erl +++ b/src/emqx_channel.erl @@ -419,13 +419,10 @@ process_publish(PacketId, Msg = #message{qos = ?QOS_2}, handle_out({pubrec, PacketId, RC}, Channel) end. -publish_to_msg(Packet, #channel{client = Client = #{mountpoint := MountPoint}, - protocol = Protocol}) -> +publish_to_msg(Packet, #channel{client = Client = #{mountpoint := MountPoint}}) -> Msg = emqx_packet:to_message(Client, Packet), Msg1 = emqx_message:set_flag(dup, false, Msg), - ProtoVer = emqx_protocol:info(proto_ver, Protocol), - Msg2 = emqx_message:set_header(proto_ver, ProtoVer, Msg1), - emqx_mountpoint:mount(MountPoint, Msg2). + emqx_mountpoint:mount(MountPoint, Msg1). %%-------------------------------------------------------------------- %% Process Subscribe diff --git a/src/emqx_packet.erl b/src/emqx_packet.erl index dc2c63cad..9f9fc7610 100644 --- a/src/emqx_packet.erl +++ b/src/emqx_packet.erl @@ -177,11 +177,10 @@ will_msg(#mqtt_packet_connect{client_id = ClientId, will_qos = QoS, will_topic = Topic, will_props = Properties, - will_payload = Payload, - proto_ver = ProtoVer}) -> + will_payload = Payload}) -> Msg = emqx_message:make(ClientId, QoS, Topic, Payload), Msg#message{flags = #{dup => false, retain => Retain}, - headers = merge_props(#{username => Username, proto_ver => ProtoVer}, Properties)}. + headers = merge_props(#{username => Username}, Properties)}. merge_props(Headers, undefined) -> Headers;