Browse Source

Don't terminate streams that were already terminated

This and the issues in the last two commits were reported
by leo2007 on IRC.
Loïc Hoguin 8 years ago
parent
commit
cbf7972f10
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/cowboy_http2.erl

+ 3 - 0
src/cowboy_http2.erl

@@ -689,6 +689,9 @@ terminate_reason({internal_error, _, _}) -> internal_error.
 
 terminate_all_streams([], _, []) ->
 	ok;
+%% This stream was already terminated and is now just flushing the data out. Skip it.
+terminate_all_streams([#stream{state=flush}|Tail], Reason, Children) ->
+	terminate_all_streams(Tail, Reason, Children);
 terminate_all_streams([#stream{id=StreamID, state=StreamState}|Tail], Reason, Children0) ->
 	stream_call_terminate(StreamID, Reason, StreamState),
 	Children = stream_terminate_children(Children0, StreamID, []),