Handle the 'discard' cast.
This commit is contained in:
parent
9f7cc80c1a
commit
738145677a
|
@ -310,6 +310,9 @@ handle({call, From}, Req, State = #state{chan_state = ChanState}) ->
|
|||
stop(Reason, State#state{chan_state = NChanState})
|
||||
end;
|
||||
|
||||
handle(cast, discard, State) ->
|
||||
shutdown(discarded, State);
|
||||
|
||||
%% Handle cast
|
||||
handle(cast, Msg, State = #state{chan_state = ChanState}) ->
|
||||
case emqx_channel:handle_cast(Msg, ChanState) of
|
||||
|
|
|
@ -244,6 +244,9 @@ websocket_info({call, From, Req}, State = #state{chan_state = ChanState}) ->
|
|||
stop(Reason, State#state{chan_state = NChanState})
|
||||
end;
|
||||
|
||||
websocket_info({cast, discard}, State) ->
|
||||
stop(discarded, State);
|
||||
|
||||
websocket_info({cast, Msg}, State = #state{chan_state = ChanState}) ->
|
||||
case emqx_channel:handle_cast(Msg, ChanState) of
|
||||
{ok, NChanState} ->
|
||||
|
@ -295,10 +298,6 @@ websocket_info({timeout, TRef, emit_stats}, State) when is_reference(TRef) ->
|
|||
websocket_info({timeout, TRef, Msg}, State) when is_reference(TRef) ->
|
||||
handle_timeout(TRef, Msg, State);
|
||||
|
||||
websocket_info({shutdown, discard, {ClientId, ByPid}}, State) ->
|
||||
?LOG(warning, "Discarded by ~s:~p", [ClientId, ByPid]),
|
||||
stop(discard, State);
|
||||
|
||||
websocket_info({shutdown, conflict, {ClientId, NewPid}}, State) ->
|
||||
?LOG(warning, "Clientid '~s' conflict with ~p", [ClientId, NewPid]),
|
||||
stop(conflict, State);
|
||||
|
|
Loading…
Reference in New Issue