commit
9f8461c67b
|
@ -120,19 +120,17 @@ wrap(Header, Rest) ->
|
||||||
parse_packet(#mqtt_packet_header{type = ?CONNECT}, FrameBin, _Options) ->
|
parse_packet(#mqtt_packet_header{type = ?CONNECT}, FrameBin, _Options) ->
|
||||||
{ProtoName, Rest} = parse_utf8_string(FrameBin),
|
{ProtoName, Rest} = parse_utf8_string(FrameBin),
|
||||||
<<BridgeTag:4, ProtoVer:4, Rest1/binary>> = Rest,
|
<<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,
|
<<UsernameFlag : 1,
|
||||||
PasswordFlag : 1,
|
PasswordFlag : 1,
|
||||||
WillRetain : 1,
|
WillRetain : 1,
|
||||||
WillQoS : 2,
|
WillQoS : 2,
|
||||||
WillFlag : 1,
|
WillFlag : 1,
|
||||||
CleanStart : 1,
|
CleanStart : 1,
|
||||||
_Reserved : 1,
|
0 : 0,
|
||||||
KeepAlive : 16/big,
|
KeepAlive : 16/big,
|
||||||
Rest2/binary>> = Rest1,
|
Rest2/binary>> = Rest1,
|
||||||
case protocol_approved(ProtoVer, ProtoName) of
|
|
||||||
true -> ok;
|
|
||||||
false -> error(protocol_name_unapproved)
|
|
||||||
end,
|
|
||||||
{Properties, Rest3} = parse_properties(Rest2, ProtoVer),
|
{Properties, Rest3} = parse_properties(Rest2, ProtoVer),
|
||||||
{ClientId, Rest4} = parse_utf8_string(Rest3),
|
{ClientId, Rest4} = parse_utf8_string(Rest3),
|
||||||
ConnPacket = #mqtt_packet_connect{proto_name = ProtoName,
|
ConnPacket = #mqtt_packet_connect{proto_name = ProtoName,
|
||||||
|
|
Loading…
Reference in New Issue