Merge pull request #584 from emqtt/emq10
Fix issue#575 - Compatible with the Qos0 PUBREL packet
This commit is contained in:
commit
3166ebba92
|
@ -44,10 +44,10 @@ limit(Opts) ->
|
||||||
-> {ok, mqtt_packet()} | {error, any()} | {more, fun()}).
|
-> {ok, mqtt_packet()} | {error, any()} | {more, fun()}).
|
||||||
parse(<<>>, {none, Limit}) ->
|
parse(<<>>, {none, Limit}) ->
|
||||||
{more, fun(Bin) -> parse(Bin, {none, Limit}) end};
|
{more, fun(Bin) -> parse(Bin, {none, Limit}) end};
|
||||||
parse(<<PacketType:4, Dup:1, QoS:2, Retain:1, Rest/binary>>, {none, Limit}) ->
|
parse(<<Type:4, Dup:1, QoS:2, Retain:1, Rest/binary>>, {none, Limit}) ->
|
||||||
parse_remaining_len(Rest, #mqtt_packet_header{type = PacketType,
|
parse_remaining_len(Rest, #mqtt_packet_header{type = Type,
|
||||||
dup = bool(Dup),
|
dup = bool(Dup),
|
||||||
qos = QoS,
|
qos = fixqos(Type, QoS),
|
||||||
retain = bool(Retain)}, Limit);
|
retain = bool(Retain)}, Limit);
|
||||||
parse(Bin, Cont) -> Cont(Bin).
|
parse(Bin, Cont) -> Cont(Bin).
|
||||||
|
|
||||||
|
@ -218,3 +218,9 @@ bool(1) -> true.
|
||||||
protocol_name_approved(Ver, Name) ->
|
protocol_name_approved(Ver, Name) ->
|
||||||
lists:member({Ver, Name}, ?PROTOCOL_NAMES).
|
lists:member({Ver, Name}, ?PROTOCOL_NAMES).
|
||||||
|
|
||||||
|
%% Fix Issue#575
|
||||||
|
fixqos(?PUBREL, 0) -> 1;
|
||||||
|
fixqos(?SUBSCRIBE, 0) -> 1;
|
||||||
|
fixqos(?UNSUBSCRIBE, 0) -> 1;
|
||||||
|
fixqos(_Type, QoS) -> QoS.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue