Skip to content

Commit

Permalink
Handle CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zuiderkwast committed Oct 2, 2023
1 parent 25f84f4 commit 112a328
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/gun_http2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,8 @@ request(State=#http2_state{http2_machine=HTTP2Machine}, StreamRef, ReplyTo, Meth
case cow_http2_machine:is_remote_concurrency_limit_reached(HTTP2Machine) of
true ->
ReplyTo ! {gun_error, self(), stream_ref(State, StreamRef),
too_many_streams},
{stream_error, too_many_streams,
'Maximum concurrency limit has been reached.'}},
{[], CookieStore, EvHandlerState};
false ->
request1(State, StreamRef, ReplyTo, Method, Host, Port,
Expand Down
16 changes: 11 additions & 5 deletions test/rfc7540_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,21 @@ lingering_data_counts_toward_connection_window(_) ->
respect_max_concurrent_streams(_) ->
doc("The SETTINGS_MAX_CONCURRENT_STREAMS setting can be used to "
"restrict the number of concurrent streams. (RFC7540 5.1.2, RFC7540 6.5.2)"),
{ok, Ref, Port} = do_cowboy_max_councurrent_streams(1),
Ref = make_ref(),
Routes = [{'_', [{"/delayed", delayed_hello_h, 500}]}],
ProtoOpts = #{
env => #{dispatch => cowboy_router:compile(Routes)},
tcp => #{protocols => [http2]},
max_concurrent_streams => 1
},
[{ref, _}, {port, Port}] = gun_test:init_cowboy_tcp(Ref, ProtoOpts, []),
try
{ok, ConnPid} = gun:open("localhost", Port, #{protocols => [http2]}),
{ok, http2} = gun:await_up(ConnPid),
StreamRef1 = gun:get(ConnPid, "/"),
timer:sleep(100),
StreamRef2 = gun:get(ConnPid, "/"),
StreamRef1 = gun:get(ConnPid, "/delayed"),
StreamRef2 = gun:get(ConnPid, "/delayed"),
{error, {stream_error, Reason}} = gun:await(ConnPid, StreamRef2),
too_many_streams = Reason,
{stream_error, too_many_streams, _Human} = Reason,
{response, nofin, 200, _} = gun:await(ConnPid, StreamRef1),
{ok, _} = gun:await_body(ConnPid, StreamRef1),
gun:close(ConnPid)
Expand Down

0 comments on commit 112a328

Please sign in to comment.