Remove will message when received disconnect packet with reason code 0x00

This commit is contained in:
周子博 2018-09-29 09:19:33 +08:00 committed by huangdan
parent 2d354ca883
commit 59798762a9
1 changed files with 3 additions and 1 deletions

View File

@ -412,12 +412,14 @@ process_packet(?DISCONNECT_PACKET(?RC_SUCCESS, #{'Session-Expiry-Interval' := In
case Interval =/= 0 andalso OldInterval =:= 0 of
true ->
deliver({disconnect, ?RC_PROTOCOL_ERROR}, PState),
{error, protocol_error, PState};
{error, protocol_error, PState#pstate{will_msg = undefined}};
false ->
emqx_session:update_expiry_interval(SPid, Interval),
%% Clean willmsg
{stop, normal, PState#pstate{will_msg = undefined}}
end;
process_packet(?DISCONNECT_PACKET(?RC_SUCCESS), PState) ->
{stop, normal, PState#pstate{will_msg = undefined}};
process_packet(?DISCONNECT_PACKET(_), PState) ->
{stop, normal, PState}.