瀏覽代碼

Remove proto_ver field stored in the headers of message

zhouzb 6 年之前
父節點
當前提交
5a3645c97e
共有 2 個文件被更改,包括 4 次插入8 次删除
  1. 2 5
      src/emqx_channel.erl
  2. 2 3
      src/emqx_packet.erl

+ 2 - 5
src/emqx_channel.erl

@@ -419,13 +419,10 @@ process_publish(PacketId, Msg = #message{qos = ?QOS_2},
             handle_out({pubrec, PacketId, RC}, Channel)
             handle_out({pubrec, PacketId, RC}, Channel)
     end.
     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),
     Msg = emqx_packet:to_message(Client, Packet),
     Msg1 = emqx_message:set_flag(dup, false, Msg),
     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
 %% Process Subscribe

+ 2 - 3
src/emqx_packet.erl

@@ -177,11 +177,10 @@ will_msg(#mqtt_packet_connect{client_id    = ClientId,
                               will_qos     = QoS,
                               will_qos     = QoS,
                               will_topic   = Topic,
                               will_topic   = Topic,
                               will_props   = Properties,
                               will_props   = Properties,
-                              will_payload = Payload,
-                              proto_ver    = ProtoVer}) ->
+                              will_payload = Payload}) ->
     Msg = emqx_message:make(ClientId, QoS, Topic, Payload),
     Msg = emqx_message:make(ClientId, QoS, Topic, Payload),
     Msg#message{flags = #{dup => false, retain => Retain},
     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) ->
 merge_props(Headers, undefined) ->
     Headers;
     Headers;