mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
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.
This commit is contained in:
parent
95d2855f62
commit
6100470c90
1 changed files with 4 additions and 2 deletions
|
@ -109,7 +109,7 @@
|
||||||
%% Currently active HTTP/1.1 streams.
|
%% Currently active HTTP/1.1 streams.
|
||||||
streams = [] :: [stream()],
|
streams = [] :: [stream()],
|
||||||
|
|
||||||
%% Children which are in the process of shutting down.
|
%% Children processes created by streams.
|
||||||
children = [] :: [{pid(), cowboy_stream:streamid(), timeout()}]
|
children = [] :: [{pid(), cowboy_stream:streamid(), timeout()}]
|
||||||
}).
|
}).
|
||||||
|
|
||||||
|
@ -1060,7 +1060,9 @@ error_terminate(StatusCode0, State=#state{ref=Ref, socket=Socket, transport=Tran
|
||||||
terminate(State, Reason).
|
terminate(State, Reason).
|
||||||
|
|
||||||
-spec terminate(_, _) -> no_return().
|
-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.
|
exit(normal). %% @todo We probably don't want to exit normal on errors.
|
||||||
|
|
||||||
%% System callbacks.
|
%% System callbacks.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue