fix issue #383
This commit is contained in:
parent
dfbcbf961b
commit
e78d4fc39b
|
@ -79,6 +79,9 @@
|
||||||
%% Client Pid bind with session
|
%% Client Pid bind with session
|
||||||
client_pid :: pid(),
|
client_pid :: pid(),
|
||||||
|
|
||||||
|
%% Old Client Pid that has been kickout
|
||||||
|
old_client_pid :: pid(),
|
||||||
|
|
||||||
%% Last packet id of the session
|
%% Last packet id of the session
|
||||||
packet_id = 1,
|
packet_id = 1,
|
||||||
|
|
||||||
|
@ -404,6 +407,7 @@ handle_cast({resume, ClientId, ClientPid}, Session = #session{client_id = C
|
||||||
[cancel_timer(TRef) || TRef <- maps:values(AwaitingComp)],
|
[cancel_timer(TRef) || TRef <- maps:values(AwaitingComp)],
|
||||||
|
|
||||||
Session1 = Session#session{client_pid = ClientPid,
|
Session1 = Session#session{client_pid = ClientPid,
|
||||||
|
old_client_pid = OldClientPid,
|
||||||
clean_sess = false,
|
clean_sess = false,
|
||||||
awaiting_ack = #{},
|
awaiting_ack = #{},
|
||||||
awaiting_comp = #{},
|
awaiting_comp = #{},
|
||||||
|
@ -561,6 +565,10 @@ handle_info({'EXIT', ClientPid, Reason}, Session = #session{clean_sess = fals
|
||||||
TRef = timer(Expires, expired),
|
TRef = timer(Expires, expired),
|
||||||
hibernate(Session#session{client_pid = undefined, expired_timer = TRef});
|
hibernate(Session#session{client_pid = undefined, expired_timer = TRef});
|
||||||
|
|
||||||
|
handle_info({'EXIT', Pid, _Reason}, Session = #session{old_client_pid = Pid}) ->
|
||||||
|
%%ignore
|
||||||
|
hibernate(Session);
|
||||||
|
|
||||||
handle_info({'EXIT', Pid, Reason}, Session = #session{client_pid = ClientPid}) ->
|
handle_info({'EXIT', Pid, Reason}, Session = #session{client_pid = ClientPid}) ->
|
||||||
|
|
||||||
?LOG(error, "Unexpected EXIT: client_pid=~p, exit_pid=~p, reason=~p",
|
?LOG(error, "Unexpected EXIT: client_pid=~p, exit_pid=~p, reason=~p",
|
||||||
|
@ -595,7 +603,8 @@ kick(_ClientId, Pid, Pid) ->
|
||||||
kick(ClientId, OldPid, Pid) ->
|
kick(ClientId, OldPid, Pid) ->
|
||||||
unlink(OldPid),
|
unlink(OldPid),
|
||||||
OldPid ! {shutdown, conflict, {ClientId, Pid}},
|
OldPid ! {shutdown, conflict, {ClientId, Pid}},
|
||||||
ok.
|
%% Clean noproc
|
||||||
|
receive {'EXIT', OldPid, _} -> ok after 0 -> ok end.
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% Check inflight and awaiting_rel
|
%% Check inflight and awaiting_rel
|
||||||
|
|
Loading…
Reference in New Issue