Remove proto_ver field stored in the headers of message

This commit is contained in:
zhouzb 2019-09-06 14:51:52 +08:00
parent 3038bd4570
commit 5a3645c97e
2 changed files with 4 additions and 8 deletions

View File

@ -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

View File

@ -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;