game: Make sure the supervisor process doesn't die.
This commit is contained in:
parent
02983da6f7
commit
16bbe2e308
@ -55,10 +55,14 @@ supervisor() ->
|
|||||||
%% @doc Close the connection for the given user and cleanup.
|
%% @doc Close the connection for the given user and cleanup.
|
||||||
|
|
||||||
supervisor_close(Pid) ->
|
supervisor_close(Pid) ->
|
||||||
User = egs_db:users_select_by_pid(Pid),
|
try
|
||||||
log(User#users.gid, "quit"),
|
User = egs_db:users_select_by_pid(Pid),
|
||||||
lists:foreach(fun(Other) -> Other#users.pid ! {psu_player_unspawn, User} end, egs_db:users_select_others_in_area(User)),
|
log(User#users.gid, "quit"),
|
||||||
egs_db:users_delete(User#users.gid).
|
lists:foreach(fun(Other) -> Other#users.pid ! {psu_player_unspawn, User} end, egs_db:users_select_others_in_area(User)),
|
||||||
|
egs_db:users_delete(User#users.gid)
|
||||||
|
catch _:_ ->
|
||||||
|
ignore
|
||||||
|
end.
|
||||||
|
|
||||||
%% @doc Listen for connections.
|
%% @doc Listen for connections.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user