Fix session shutdown bug

This commit is contained in:
turtled 2018-12-21 22:44:58 +08:00
parent bb45825e77
commit f7596b8131
1 changed files with 3 additions and 3 deletions

View File

@ -391,12 +391,12 @@ handle_call(stats, _From, State) ->
handle_call({discard, ByPid}, _From, State = #state{conn_pid = undefined}) ->
?LOG(warning, "Discarded by ~p", [ByPid], State),
{stop, discarded, ok, State};
{stop, {shutdown, discarded}, ok, State};
handle_call({discard, ByPid}, _From, State = #state{client_id = ClientId, conn_pid = ConnPid}) ->
?LOG(warning, "Conn ~p is discarded by ~p", [ConnPid, ByPid], State),
ConnPid ! {shutdown, discard, {ClientId, ByPid}},
{stop, discarded, ok, State};
{stop, {shutdown, discarded}, ok, State};
%% PUBLISH: This is only to register packetId to session state.
%% The actual message dispatching should be done by the caller (e.g. connection) process.
@ -1015,5 +1015,5 @@ noreply(State) ->
{noreply, State}.
shutdown(Reason, State) ->
{stop, Reason, State}.
{stop, {shutdown, Reason}, State}.