fix(mqtt_sn): handle disconnect msg in asleep state
This commit is contained in:
parent
a925395814
commit
b8cb930c89
|
@ -390,7 +390,7 @@ asleep(cast, {incoming, ?SN_DISCONNECT_MSG(Duration)}, State) ->
|
||||||
ok = send_message(?SN_DISCONNECT_MSG(undefined), State),
|
ok = send_message(?SN_DISCONNECT_MSG(undefined), State),
|
||||||
case Duration of
|
case Duration of
|
||||||
undefined ->
|
undefined ->
|
||||||
handle_incoming(?PACKET(?DISCONNECT), State);
|
handle_incoming(?DISCONNECT_PACKET(), State);
|
||||||
_Other ->
|
_Other ->
|
||||||
goto_asleep_state(Duration, State)
|
goto_asleep_state(Duration, State)
|
||||||
end;
|
end;
|
||||||
|
@ -548,6 +548,9 @@ handle_event(info, asleep_timeout, StateName, State) ->
|
||||||
?LOG(debug, "asleep timer timeout on StateName=~p, ignore it", [StateName], State),
|
?LOG(debug, "asleep timer timeout on StateName=~p, ignore it", [StateName], State),
|
||||||
{keep_state, State};
|
{keep_state, State};
|
||||||
|
|
||||||
|
handle_event(cast, {close, Reason}, _StateName, State) ->
|
||||||
|
stop(Reason, State);
|
||||||
|
|
||||||
handle_event(cast, {event, connected}, _StateName, State = #state{channel = Channel}) ->
|
handle_event(cast, {event, connected}, _StateName, State = #state{channel = Channel}) ->
|
||||||
ClientId = emqx_channel:info(clientid, Channel),
|
ClientId = emqx_channel:info(clientid, Channel),
|
||||||
emqx_cm:insert_channel_info(ClientId, info(State), stats(State)),
|
emqx_cm:insert_channel_info(ClientId, info(State), stats(State)),
|
||||||
|
|
Loading…
Reference in New Issue