Drop will msg when receive the DISCONNECT packet whose reason code is equal to 0x00

This commit is contained in:
周子博 2018-09-05 18:03:28 +08:00
parent 47955f4309
commit 9029ee29d3
1 changed files with 8 additions and 2 deletions

View File

@ -396,9 +396,15 @@ process_packet(?UNSUBSCRIBE_PACKET(PacketId, Properties, RawTopicFilters),
process_packet(?PACKET(?PINGREQ), PState) ->
send(?PACKET(?PINGRESP), PState);
process_packet(?PACKET(?DISCONNECT), PState) ->
process_packet(?DISCONNECT_PACKET(16#00), PState) ->
%% Clean willmsg
{stop, normal, PState#pstate{will_msg = undefined}}.
{stop, normal, PState#pstate{will_msg = undefined}};
process_packet(?DISCONNECT_PACKET(_), PState) ->
{stop, normal, PState};
process_packet(Packet = ?PACKET(?DISCONNECT), PState) ->
if Packet#mqtt_packet.variable =:= undefined ->
{stop, normal, PState#pstate{will_msg = undefined}}
end.
%%------------------------------------------------------------------------------
%% ConnAck --> Client