Skip to content

Commit

Permalink
Fix session shutdown bug
Browse files Browse the repository at this point in the history
  • Loading branch information
turtled committed Dec 21, 2018
1 parent bb45825 commit f7596b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/emqx_session.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -1015,5 +1015,5 @@ noreply(State) ->
{noreply, State}.

shutdown(Reason, State) ->
{stop, Reason, State}.
{stop, {shutdown, Reason}, State}.

0 comments on commit f7596b8

Please sign in to comment.