refactor(mqtt_frame): Avoid duplicate variable when frame assembling.
This commit is contained in:
parent
35cc0d972d
commit
c54847b6e9
|
@ -100,14 +100,10 @@ parse(<<Type:4, Dup:1, QoS:2, Retain:1, Rest/binary>>,
|
||||||
StrictMode andalso validate_header(Type, Dup, QoS, Retain),
|
StrictMode andalso validate_header(Type, Dup, QoS, Retain),
|
||||||
Header = #mqtt_packet_header{type = Type,
|
Header = #mqtt_packet_header{type = Type,
|
||||||
dup = bool(Dup),
|
dup = bool(Dup),
|
||||||
qos = QoS,
|
qos = fixqos(Type, QoS),
|
||||||
retain = bool(Retain)
|
retain = bool(Retain)
|
||||||
},
|
},
|
||||||
Header1 = case fixqos(Type, QoS) of
|
parse_remaining_len(Rest, Header, Options);
|
||||||
QoS -> Header;
|
|
||||||
FixedQoS -> Header#mqtt_packet_header{qos = FixedQoS}
|
|
||||||
end,
|
|
||||||
parse_remaining_len(Rest, Header1, Options);
|
|
||||||
|
|
||||||
parse(Bin, {{len, #{hdr := Header,
|
parse(Bin, {{len, #{hdr := Header,
|
||||||
len := {Multiplier, Length}}
|
len := {Multiplier, Length}}
|
||||||
|
|
Loading…
Reference in New Issue