aboutsummaryrefslogtreecommitdiffstats
path: root/src/cow_http2_machine.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cow_http2_machine.erl')
-rw-r--r--src/cow_http2_machine.erl17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cow_http2_machine.erl b/src/cow_http2_machine.erl
index 68d361a..754b82b 100644
--- a/src/cow_http2_machine.erl
+++ b/src/cow_http2_machine.erl
@@ -1381,12 +1381,19 @@ ensure_window(Size, State=#http2_machine{opts=Opts, remote_window=RemoteWindow})
-spec ensure_window(cow_http2:streamid(), non_neg_integer(), State)
-> ok | {ok, pos_integer(), State} when State::http2_machine().
ensure_window(StreamID, Size, State=#http2_machine{opts=Opts}) ->
- Stream = #stream{remote_window=RemoteWindow} = stream_get(StreamID, State),
- case ensure_window(Size, RemoteWindow, stream, Opts) of
- ok ->
+ case stream_get(StreamID, State) of
+ %% For simplicity's sake, we do not consider attempts to ensure the window
+ %% of a terminated stream to be errors. We simply act as if the stream
+ %% window is large enough.
+ undefined ->
ok;
- {ok, Increment} ->
- {ok, Increment, stream_store(Stream#stream{remote_window=RemoteWindow + Increment}, State)}
+ Stream = #stream{remote_window=RemoteWindow} ->
+ case ensure_window(Size, RemoteWindow, stream, Opts) of
+ ok ->
+ ok;
+ {ok, Increment} ->
+ {ok, Increment, stream_store(Stream#stream{remote_window=RemoteWindow + Increment}, State)}
+ end
end.
%% No need to update the window when we are not expecting data.