aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_http2.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gun_http2.erl')
-rw-r--r--src/gun_http2.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gun_http2.erl b/src/gun_http2.erl
index eb6f06c..8746b3e 100644
--- a/src/gun_http2.erl
+++ b/src/gun_http2.erl
@@ -769,10 +769,15 @@ create_stream(State=#http2_state{streams=Streams, stream_refs=Refs},
store_stream(State=#http2_state{streams=Streams}, Stream=#stream{id=StreamID}) ->
State#http2_state{streams=Streams#{StreamID => Stream}}.
-take_stream(State=#http2_state{streams=Streams0}, StreamID) ->
+take_stream(State=#http2_state{streams=Streams0, stream_refs=Refs}, StreamID) ->
case maps:take(StreamID, Streams0) of
- {Stream, Streams} -> {Stream, State#http2_state{streams=Streams}};
- error -> error
+ {Stream=#stream{ref=StreamRef}, Streams} ->
+ {Stream, State#http2_state{
+ streams=Streams,
+ stream_refs=maps:remove(StreamRef, Refs)
+ }};
+ error ->
+ error
end.
maybe_delete_stream(State=#http2_state{http2_machine=HTTP2Machine}, StreamID, local, fin) ->