aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-04-18 16:33:41 +0200
committerLoïc Hoguin <[email protected]>2017-04-18 16:33:41 +0200
commitb7210d6d1ab48c859c7dde0fd9290dae010ddd15 (patch)
treef59a4f96aa79b67b0ba759964ec0e505b9f4ac36
parent061cc227b17a9c7bcaae0b83fb689666781f6bf5 (diff)
downloadcowboy-b7210d6d1ab48c859c7dde0fd9290dae010ddd15.tar.gz
cowboy-b7210d6d1ab48c859c7dde0fd9290dae010ddd15.tar.bz2
cowboy-b7210d6d1ab48c859c7dde0fd9290dae010ddd15.zip
Get rid of stray messages when killing HTTP/2 request processes
-rw-r--r--src/cowboy_http2.erl3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl
index d93a6cd..a280c5f 100644
--- a/src/cowboy_http2.erl
+++ b/src/cowboy_http2.erl
@@ -693,6 +693,9 @@ stream_call_terminate(StreamID, Reason, StreamState) ->
stream_terminate_children([], _, Acc) ->
Acc;
stream_terminate_children([{Pid, StreamID}|Tail], StreamID, Acc) ->
+ %% We unlink and flush the mailbox to avoid receiving a stray message.
+ unlink(Pid),
+ receive {'EXIT', Pid, _} -> ok after 0 -> ok end,
exit(Pid, kill),
stream_terminate_children(Tail, StreamID, Acc);
stream_terminate_children([Child|Tail], StreamID, Acc) ->