aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-05-03 18:31:28 +0200
committerLoïc Hoguin <[email protected]>2017-05-03 18:31:28 +0200
commit6100470c900d395e8000114df12e7f03e09d6183 (patch)
tree01451c7bb61df287e91bc8293f8ede6decd64a0d /src
parent95d2855f62aa31cfc65f270811c71edc43476aff (diff)
downloadcowboy-6100470c900d395e8000114df12e7f03e09d6183.tar.gz
cowboy-6100470c900d395e8000114df12e7f03e09d6183.tar.bz2
cowboy-6100470c900d395e8000114df12e7f03e09d6183.zip
Kill all children processes when terminating the connection
This is a more or less temporary solution to an existing problem. In the future we will need to enforce a shutdown timeout for these processes.
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_http.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index d81cf3a..9c2bf30 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -109,7 +109,7 @@
%% Currently active HTTP/1.1 streams.
streams = [] :: [stream()],
- %% Children which are in the process of shutting down.
+ %% Children processes created by streams.
children = [] :: [{pid(), cowboy_stream:streamid(), timeout()}]
}).
@@ -1060,7 +1060,9 @@ error_terminate(StatusCode0, State=#state{ref=Ref, socket=Socket, transport=Tran
terminate(State, Reason).
-spec terminate(_, _) -> no_return().
-terminate(_State, _Reason) ->
+terminate(#state{children=Children}, _Reason) ->
+ %% @todo Leave them time to terminate.
+ _ = [exit(Pid, kill) || {Pid, _, _} <- Children],
exit(normal). %% @todo We probably don't want to exit normal on errors.
%% System callbacks.