diff options
author | Loïc Hoguin <[email protected]> | 2018-10-28 10:20:43 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-10-28 10:20:43 +0100 |
commit | d4129e63051efb29d7955e7913571671471090a5 (patch) | |
tree | 0d881b7cb300ac4c51777ee9623834c8d5007e84 /src/cowboy_http.erl | |
parent | 21ff3ff256acc6c56e2ab35bb9712ea7b8ef6687 (diff) | |
download | cowboy-d4129e63051efb29d7955e7913571671471090a5.tar.gz cowboy-d4129e63051efb29d7955e7913571671471090a5.tar.bz2 cowboy-d4129e63051efb29d7955e7913571671471090a5.zip |
Exit gracefully on parent exit/sys:terminate/2,3
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r-- | src/cowboy_http.erl | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index 71d33ce..b1c8dbe 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -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, _, _, _) -> |