Explorar o código

Merge pull request #1783 from tigercl/emqx30

Change in CONNECT packet
Feng Lee %!s(int64=7) %!d(string=hai) anos
pai
achega
9f8461c67b
Modificáronse 1 ficheiros con 3 adicións e 5 borrados
  1. 3 5
      src/emqx_frame.erl

+ 3 - 5
src/emqx_frame.erl

@@ -120,19 +120,17 @@ wrap(Header, Rest) ->
 parse_packet(#mqtt_packet_header{type = ?CONNECT}, FrameBin, _Options) ->
     {ProtoName, Rest} = parse_utf8_string(FrameBin),
     <<BridgeTag:4, ProtoVer:4, Rest1/binary>> = Rest,
+    % Note: Crash when reserved flag doesn't equal to 0, there is no strict compliance with the MQTT5.0.
     <<UsernameFlag : 1,
       PasswordFlag : 1,
       WillRetain   : 1,
       WillQoS      : 2,
       WillFlag     : 1,
       CleanStart   : 1,
-      _Reserved    : 1,
+      0            : 0,         
       KeepAlive    : 16/big,
       Rest2/binary>> = Rest1,
-    case protocol_approved(ProtoVer, ProtoName) of
-        true  -> ok;
-        false -> error(protocol_name_unapproved)
-    end,
+
     {Properties, Rest3} = parse_properties(Rest2, ProtoVer),
     {ClientId, Rest4} = parse_utf8_string(Rest3),
     ConnPacket = #mqtt_packet_connect{proto_name   = ProtoName,