aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2023-12-19 11:09:54 +0100
committerLoïc Hoguin <[email protected]>2023-12-19 11:09:54 +0100
commit8fdb74a5108fa8ec4e9a14fe7a9bc9686d7aad63 (patch)
tree074dc9e9754f4c6d0ff5846bc4dcc0a337dd8226
parent627a4508b539f98fb632b4ff9a92a4f9c2c54890 (diff)
downloadcowboy-8fdb74a5108fa8ec4e9a14fe7a9bc9686d7aad63.tar.gz
cowboy-8fdb74a5108fa8ec4e9a14fe7a9bc9686d7aad63.tar.bz2
cowboy-8fdb74a5108fa8ec4e9a14fe7a9bc9686d7aad63.zip
Shave off a few more seconds from rfc7540_SUITE
-rw-r--r--src/cowboy_http2.erl1
-rw-r--r--test/rfc7540_SUITE.erl21
2 files changed, 15 insertions, 7 deletions
diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl
index ebd02bc..04935fb 100644
--- a/src/cowboy_http2.erl
+++ b/src/cowboy_http2.erl
@@ -1094,6 +1094,7 @@ terminate(State=#state{socket=Socket, transport=Transport, http2_status=Status,
end,
terminate_all_streams(State, maps:to_list(Streams), Reason),
cowboy_children:terminate(Children),
+ %% @todo Don't linger on connection errors.
terminate_linger(State),
exit({shutdown, Reason});
%% We are not fully connected so we can just terminate the connection.
diff --git a/test/rfc7540_SUITE.erl b/test/rfc7540_SUITE.erl
index 11e8202..986c376 100644
--- a/test/rfc7540_SUITE.erl
+++ b/test/rfc7540_SUITE.erl
@@ -1405,7 +1405,8 @@ max_frame_size_reject_larger_than_custom(Config0) ->
cow_http2:data(1, fin, <<0:30001/unit:8>>)
]),
%% Receive a FRAME_SIZE_ERROR connection error.
- {ok, << _:24, 7:8, _:72, 6:32 >>} = gen_tcp:recv(Socket, 17, 6000)
+ {ok, << _:24, 7:8, _:72, 6:32 >>} = gen_tcp:recv(Socket, 17, 6000),
+ gen_tcp:close(Socket)
after
cowboy:stop_listener(?FUNCTION_NAME)
end.
@@ -2620,9 +2621,10 @@ settings_header_table_size_server(Config0) ->
{ok, << Len1:24, 1:8, _:40 >>} = gen_tcp:recv(Socket, 9, 6000),
{ok, RespHeadersBlock1} = gen_tcp:recv(Socket, Len1, 6000),
{RespHeaders, _} = cow_hpack:decode(RespHeadersBlock1, DecodeState),
- {_, <<"200">>} = lists:keyfind(<<":status">>, 1, RespHeaders)
+ {_, <<"200">>} = lists:keyfind(<<":status">>, 1, RespHeaders),
%% The decoding succeeded on the server, confirming that
%% the table size was updated to HeaderTableSize.
+ gen_tcp:close(Socket)
after
cowboy:stop_listener(?FUNCTION_NAME)
end.
@@ -2651,7 +2653,8 @@ settings_max_concurrent_streams(Config0) ->
cow_http2:headers(3, fin, ReqHeadersBlock2)
]),
%% Receive a REFUSED_STREAM stream error.
- {ok, << _:24, 3:8, _:8, 3:32, 7:32 >>} = gen_tcp:recv(Socket, 13, 6000)
+ {ok, << _:24, 3:8, _:8, 3:32, 7:32 >>} = gen_tcp:recv(Socket, 13, 6000),
+ gen_tcp:close(Socket)
after
cowboy:stop_listener(?FUNCTION_NAME)
end.
@@ -2675,7 +2678,8 @@ settings_max_concurrent_streams_0(Config0) ->
]),
ok = gen_tcp:send(Socket, cow_http2:headers(1, fin, HeadersBlock)),
%% Receive a REFUSED_STREAM stream error.
- {ok, << _:24, 3:8, _:8, 1:32, 7:32 >>} = gen_tcp:recv(Socket, 13, 6000)
+ {ok, << _:24, 3:8, _:8, 1:32, 7:32 >>} = gen_tcp:recv(Socket, 13, 6000),
+ gen_tcp:close(Socket)
after
cowboy:stop_listener(?FUNCTION_NAME)
end.
@@ -2787,7 +2791,8 @@ settings_initial_window_size_after_ack(Config0) ->
cow_http2:data(1, fin, <<0:32/unit:8>>)
]),
%% Receive a FLOW_CONTROL_ERROR stream error.
- {ok, << _:24, 3:8, _:8, 1:32, 3:32 >>} = gen_tcp:recv(Socket, 13, 6000)
+ {ok, << _:24, 3:8, _:8, 1:32, 3:32 >>} = gen_tcp:recv(Socket, 13, 6000),
+ gen_tcp:close(Socket)
after
cowboy:stop_listener(?FUNCTION_NAME)
end.
@@ -3119,7 +3124,8 @@ data_reject_overflow(Config0) ->
cow_http2:data(1, fin, <<0:15000/unit:8>>)
]),
%% Receive a FLOW_CONTROL_ERROR connection error.
- {ok, << _:24, 7:8, _:72, 3:32 >>} = gen_tcp:recv(Socket, 17, 6000)
+ {ok, << _:24, 7:8, _:72, 3:32 >>} = gen_tcp:recv(Socket, 17, 6000),
+ gen_tcp:close(Socket)
after
cowboy:stop_listener(?FUNCTION_NAME)
end.
@@ -3167,7 +3173,8 @@ data_reject_overflow_stream(Config0) ->
cow_http2:data(1, fin, <<0:15000/unit:8>>)
]),
%% Receive a FLOW_CONTROL_ERROR stream error.
- {ok, << _:24, 3:8, _:8, 1:32, 3:32 >>} = gen_tcp:recv(Socket, 13, 6000)
+ {ok, << _:24, 3:8, _:8, 1:32, 3:32 >>} = gen_tcp:recv(Socket, 13, 6000),
+ gen_tcp:close(Socket)
after
cowboy:stop_listener(?FUNCTION_NAME)
end.