mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Exit gracefully on parent exit/sys:terminate/2,3
This commit is contained in:
parent
21ff3ff256
commit
d4129e6305
5 changed files with 11 additions and 17 deletions
|
@ -209,8 +209,7 @@ loop(State=#state{parent=Parent, socket=Socket, transport=Transport, opts=Opts,
|
|||
loop(State, Buffer);
|
||||
%% System messages.
|
||||
{'EXIT', Parent, Reason} ->
|
||||
%% @todo We should exit gracefully, if possible.
|
||||
exit(Reason);
|
||||
terminate(State, {stop, {exit, Reason}, 'Parent process terminated.'});
|
||||
{system, From, Request} ->
|
||||
sys:handle_system_msg(Request, From, Parent, ?MODULE, [], {State, Buffer});
|
||||
%% Messages pertaining to a stream.
|
||||
|
@ -1379,8 +1378,7 @@ system_continue(_, _, {State, Buffer}) ->
|
|||
|
||||
-spec system_terminate(any(), _, _, {#state{}, binary()}) -> no_return().
|
||||
system_terminate(Reason, _, _, {State, _}) ->
|
||||
%% @todo We should exit gracefully, if possible.
|
||||
terminate(State, Reason).
|
||||
terminate(State, {stop, {exit, Reason}, 'sys:terminate/2,3 was called.'}).
|
||||
|
||||
-spec system_code_change(Misc, _, _, _) -> {ok, Misc} when Misc::{#state{}, binary()}.
|
||||
system_code_change(Misc, _, _, _) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue