Browse Source

HTTP/2: Handle internal errors

Loïc Hoguin 9 years ago
parent
commit
8e9196215d
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/cowboy_http2.erl

+ 4 - 0
src/cowboy_http2.erl

@@ -432,6 +432,10 @@ commands(State, StreamID, [{flow, _Size}|Tail]) ->
 %% Supervise a child process.
 %% Supervise a child process.
 commands(State=#state{children=Children}, StreamID, [{spawn, Pid, _Shutdown}|Tail]) -> %% @todo Shutdown
 commands(State=#state{children=Children}, StreamID, [{spawn, Pid, _Shutdown}|Tail]) -> %% @todo Shutdown
 	 commands(State#state{children=[{Pid, StreamID}|Children]}, StreamID, Tail);
 	 commands(State#state{children=[{Pid, StreamID}|Children]}, StreamID, Tail);
+%% Error handling.
+commands(State, StreamID, [Error = {internal_error, _, _}|Tail]) ->
+	%% @todo Only reset when the stream still exists.
+	commands(stream_reset(State, StreamID, Error), StreamID, Tail);
 %% Upgrade to a new protocol.
 %% Upgrade to a new protocol.
 %%
 %%
 %% @todo Implementation.
 %% @todo Implementation.