Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
rebar3-version: '3.24.0'
- otp-version: '28.0'
rebar3-version: '3.25.0'
- otp-version: '29.0'
rebar3-version: '3.27.0'

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{opentelemetry_api, "1.4.0"},
{opentelemetry_api_experimental, "0.5.1"},
{nhttp_lib, "1.0.3"},
{nquic, "1.0.2"}
{nquic, "1.0.3"}
]}.

{project_plugins, [
Expand Down
6 changes: 3 additions & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{"1.2.0",
[{<<"nhttp_lib">>,{pkg,<<"nhttp_lib">>,<<"1.0.3">>},0},
{<<"nquic">>,{pkg,<<"nquic">>,<<"1.0.2">>},0},
{<<"nquic">>,{pkg,<<"nquic">>,<<"1.0.3">>},0},
{<<"opentelemetry_api">>,{pkg,<<"opentelemetry_api">>,<<"1.4.0">>},0},
{<<"opentelemetry_api_experimental">>,
{pkg,<<"opentelemetry_api_experimental">>,<<"0.5.1">>},
0}]}.
[
{pkg_hash,[
{<<"nhttp_lib">>, <<"A988AEF0B7AAB3A3ADCEFEE5FCDBFDF84E7285CD31745715EC5B75C4C1E97285">>},
{<<"nquic">>, <<"B82954B494BDDED6EB6FD7A2C9A41E20889C2C47CB1D4BB4EF6139FA850E491E">>},
{<<"nquic">>, <<"1B25FD940CDF4BD7378B360484FA546D7967F60D8421CFDBEDD0774F6398D1D4">>},
{<<"opentelemetry_api">>, <<"63CA1742F92F00059298F478048DFB826F4B20D49534493D6919A0DB39B6DB04">>},
{<<"opentelemetry_api_experimental">>, <<"1B5AFACFCBD0834390336C845BC8AE08C8CF0D69BBED72EE53D178798B93E074">>}]},
{pkg_hash_ext,[
{<<"nhttp_lib">>, <<"7155A57A989118394EDB769B9472104D20645F8682053432F65C9322BA25A414">>},
{<<"nquic">>, <<"09A8804265EE9CCD4C40BC35C93F2B72C0310495841B5C5D0AA6706993EE4957">>},
{<<"nquic">>, <<"73E9675F9D1C1B2F182A961B3C689778CAD8BA178C63E57C6A23A1C5FDE427F2">>},
{<<"opentelemetry_api">>, <<"3DFBBFAA2C2ED3121C5C483162836C4F9027DEF469C41578AF5EF32589FCFC58">>},
{<<"opentelemetry_api_experimental">>, <<"10297057EADA47267D4F832011BECEF07D25690E6BF91FEBCCFC4E740DBA1A6F">>}]}
].
2 changes: 1 addition & 1 deletion test/nhttp_alt_svc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ init_per_testcase(_TestCase, Config) ->

end_per_testcase(_TestCase, _Config) ->
case erlang:erase(listener_pid) of
Pid when is_pid(Pid) -> catch nhttp:stop(Pid);
Pid when is_pid(Pid) -> nhttp:stop(Pid);
_ -> ok
end,
ok.
Expand Down
35 changes: 17 additions & 18 deletions test/nhttp_conn_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,14 @@ count_responses(Binary, Pattern, Count) ->
count_responses(Rest, Pattern, Count + 1)
end.

reregister(Name) ->
try
unregister(Name)
catch
_:_ -> ok
end,
register(Name, self()).

%%%-----------------------------------------------------------------------------
%%% CONNECTION EVENT TESTS
%%%-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1547,8 +1555,7 @@ conn_idle_timeout(_Config) ->
ok.

conn_graceful_shutdown_h1(_Config) ->
catch unregister(conn_pid_receiver),
register(conn_pid_receiver, self()),
reregister(conn_pid_receiver),

{ok, Pid} = nhttp:start_link(#{
port => 0,
Expand Down Expand Up @@ -1597,8 +1604,7 @@ conn_graceful_shutdown_h2(Config) ->
{Cert, ?config(keyfile, Config)}
end,

catch unregister(conn_pid_receiver),
register(conn_pid_receiver, self()),
reregister(conn_pid_receiver),

{ok, Pid} = nhttp:start_link(#{
port => 0,
Expand Down Expand Up @@ -2259,8 +2265,7 @@ h1_websocket_no_handler(_Config) ->
%%%-----------------------------------------------------------------------------

conn_system_messages(_Config) ->
catch unregister(conn_pid_receiver),
register(conn_pid_receiver, self()),
reregister(conn_pid_receiver),

{ok, Pid} = nhttp:start_link(#{
port => 0,
Expand Down Expand Up @@ -2787,8 +2792,7 @@ h1_pipeline_depth_limit(_Config) ->
ok.

h1_pipeline_shutdown_mid_batch(_Config) ->
catch unregister(conn_pid_receiver),
register(conn_pid_receiver, self()),
reregister(conn_pid_receiver),

{ok, Pid} = nhttp:start_link(#{
port => 0,
Expand Down Expand Up @@ -3333,8 +3337,7 @@ alpn_h2_first_fallback(_Config) ->
%%%-----------------------------------------------------------------------------

h1_hibernate_keepalive(_Config) ->
catch unregister(conn_pid_receiver),
register(conn_pid_receiver, self()),
reregister(conn_pid_receiver),

{ok, Pid} = nhttp:start_link(#{
port => 0,
Expand Down Expand Up @@ -3368,8 +3371,7 @@ h1_hibernate_keepalive(_Config) ->
ok.

h1_hibernate_idle_timeout(_Config) ->
catch unregister(conn_pid_receiver),
register(conn_pid_receiver, self()),
reregister(conn_pid_receiver),

{ok, Pid} = nhttp:start_link(#{
port => 0,
Expand Down Expand Up @@ -3462,8 +3464,7 @@ h2_hibernate_ping(Config) ->
ok.

h1_websocket_hibernate_ping(_Config) ->
catch unregister(conn_pid_receiver),
register(conn_pid_receiver, self()),
reregister(conn_pid_receiver),

{ok, Pid} = nhttp:start_link(#{
port => 0,
Expand Down Expand Up @@ -4001,8 +4002,7 @@ h1_all_other_methods(_Config) ->
ok.

h1_system_code_change(_Config) ->
catch unregister(conn_pid_receiver),
register(conn_pid_receiver, self()),
reregister(conn_pid_receiver),

{ok, Pid} = nhttp:start_link(#{
port => 0,
Expand Down Expand Up @@ -4040,8 +4040,7 @@ h1_system_code_change(_Config) ->
ok.

h1_system_terminate(_Config) ->
catch unregister(conn_pid_receiver),
register(conn_pid_receiver, self()),
reregister(conn_pid_receiver),

{ok, Pid} = nhttp:start_link(#{
port => 0,
Expand Down
12 changes: 9 additions & 3 deletions test/nhttp_conn_failure_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ h3_abrupt_close_mid_request(Config) ->
handler => nhttp_conn_h3_handler,
versions => [http3]
}),
catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),
{QConn, H3} = nhttp_h3_test_client:connect(Port),
{ok, 200, _, _, H3_1} =
nhttp_h3_test_client:request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand All @@ -254,7 +253,6 @@ h3_abrupt_close_mid_request(Config) ->
after 5000 ->
error(conn_did_not_terminate)
end,
catch unregister(h3_conn_pid_receiver),
nhttp:stop(Pid)
end).

Expand Down Expand Up @@ -303,6 +301,14 @@ with_tls(Config, Fun) ->
get_request(Path) ->
<<"GET ", Path/binary, " HTTP/1.1\r\nHost: localhost\r\n\r\n">>.

reregister(Name) ->
try
unregister(Name)
catch
_:_ -> ok
end,
register(Name, self()).

run_close_before_init(Versions) ->
{ok, LSock} = gen_tcp:listen(0, [binary, {active, false}, {reuseaddr, true}]),
{ok, Port} = inet:port(LSock),
Expand Down
38 changes: 18 additions & 20 deletions test/nhttp_conn_h3_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,13 @@ end_per_testcase(_TestCase, _Config) ->
ListenerPid when is_pid(ListenerPid) ->
case is_process_alive(ListenerPid) of
true ->
catch nhttp:stop(ListenerPid),
nhttp:stop(ListenerPid),
_ = nhttp_test_helpers:wait_until_down(ListenerPid, 1000),
ok;
false ->
ok
end
end,
catch unregister(h3_conn_pid_receiver),
flush_mailbox(),
ok.

Expand Down Expand Up @@ -548,8 +547,7 @@ h3_idle_timeout(Config) ->
h3_hibernate(Config) ->
{_, _, Port} = start_h3_server(Config, #{}),

catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),

{QConn, H3} = connect_h3(Port),
{ok, 200, _, _, H3_1} = h3_request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand Down Expand Up @@ -578,8 +576,7 @@ h3_hibernate(Config) ->
h3_graceful_shutdown(Config) ->
{_, _, Port} = start_h3_server(Config, #{}),

catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),

{QConn, H3} = connect_h3(Port),
{ok, 200, _, _, _H3_1} = h3_request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand Down Expand Up @@ -607,8 +604,7 @@ h3_graceful_shutdown(Config) ->
h3_parent_exit(Config) ->
{ListenerPid, _, Port} = start_h3_server(Config, #{}),

catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),

{QConn, H3} = connect_h3(Port),
{ok, 200, _, _, _H3_1} = h3_request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand Down Expand Up @@ -641,8 +637,7 @@ h3_parent_exit(Config) ->
h3_quic_closed(Config) ->
{_, _, Port} = start_h3_server(Config, #{}),

catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),

{QConn, H3} = connect_h3(Port),
{ok, 200, _, _, _H3_1} = h3_request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand All @@ -668,8 +663,7 @@ h3_quic_closed(Config) ->
h3_handler_terminate(Config) ->
{_, _, Port} = start_h3_server(Config, #{}),

catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),

{QConn, H3} = connect_h3(Port),
{ok, 200, _, _, _H3_1} = h3_request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand Down Expand Up @@ -698,8 +692,7 @@ h3_handler_terminate(Config) ->
h3_system_get_status(Config) ->
{_, _, Port} = start_h3_server(Config, #{}),

catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),

{QConn, H3} = connect_h3(Port),
{ok, 200, _, _, _H3_1} = h3_request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand All @@ -721,8 +714,7 @@ h3_system_get_status(Config) ->
h3_system_suspend_resume(Config) ->
{_, _, Port} = start_h3_server(Config, #{}),

catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),

{QConn, H3} = connect_h3(Port),
{ok, 200, _, _, _H3_1} = h3_request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand All @@ -746,8 +738,7 @@ h3_system_suspend_resume(Config) ->
h3_system_code_change(Config) ->
{_, _, Port} = start_h3_server(Config, #{}),

catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),

{QConn, H3} = connect_h3(Port),
{ok, 200, _, _, _H3_1} = h3_request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand All @@ -772,8 +763,7 @@ h3_system_code_change(Config) ->
h3_system_terminate(Config) ->
{_, _, Port} = start_h3_server(Config, #{}),

catch unregister(h3_conn_pid_receiver),
register(h3_conn_pid_receiver, self()),
reregister(h3_conn_pid_receiver),

{QConn, H3} = connect_h3(Port),
{ok, 200, _, _, _H3_1} = h3_request(QConn, H3, <<"GET">>, <<"/conn-pid">>, <<>>),
Expand Down Expand Up @@ -1139,3 +1129,11 @@ flush_mailbox() ->
after 0 ->
ok
end.

reregister(Name) ->
try
unregister(Name)
catch
_:_ -> ok
end,
register(Name, self()).
4 changes: 2 additions & 2 deletions test/nhttp_conn_ws_async_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ setup_ws(Mode, ExtraOpts) ->
{Sock, Server, Session}.

teardown_ws(Sock, Server) ->
catch gen_tcp:close(Sock),
catch nhttp:stop(Server),
gen_tcp:close(Sock),
nhttp:stop(Server),
flush_observer().

recv_observer_event(Tag) ->
Expand Down
4 changes: 2 additions & 2 deletions test/nhttp_h2_concurrency_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ drain_waits_for_in_flight_workers(Config) ->
after 6000 ->
error(drain_timeout)
end,
catch ssl:close(Sock)
ssl:close(Sock)
after
catch nhttp:stop(Pid)
nhttp:stop(Pid)
end.

%%%-----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions test/nhttp_h2_ws_async_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ open_extra_stream(#ctx{sock = Sock, sessions = Sessions} = Ctx, StreamId) ->
Ctx#ctx{sessions = Sessions ++ [{StreamId, Session}]}.

teardown_ws(#ctx{sock = Sock, server = Server}) ->
catch ssl:close(Sock),
catch nhttp:stop(Server),
ssl:close(Sock),
nhttp:stop(Server),
flush_observer().

h2_connect(Config, Mode, Observer) ->
Expand Down
4 changes: 2 additions & 2 deletions test/nhttp_h3_ws_async_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ open_extra_stream(#ctx{qconn = QConn, h3 = H3, streams = Streams} = Ctx) ->
Ctx#ctx{h3 = H3_1, streams = Streams ++ [{StreamId, Session}]}.

teardown_ws(#ctx{server = Server, qconn = QConn}) ->
catch nhttp_h3_test_client:close(QConn),
catch nhttp:stop(Server),
nhttp_h3_test_client:close(QConn),
nhttp:stop(Server),
flush_observer().

h3_connect(Config, Mode, Observer) ->
Expand Down
6 changes: 3 additions & 3 deletions test/nhttp_mixed_listener_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ init_per_testcase(_TestCase, Config) ->
end_per_testcase(_TestCase, Config) ->
case erlang:get(listener_pid) of
Pid when is_pid(Pid) ->
catch nhttp:stop(Pid),
nhttp:stop(Pid),
erlang:erase(listener_pid);
_ ->
ok
Expand Down Expand Up @@ -165,7 +165,7 @@ mixed_max_connections_per_transport(Config) ->
?assertEqual(<<"Hello!">>, Body),

nhttp_h3_test_client:close(QConn),
catch ssl:close(Sock1),
ssl:close(Sock1),
ok.

mixed_drain_waits_both(Config) ->
Expand All @@ -186,7 +186,7 @@ mixed_drain_waits_both(Config) ->
end,

nhttp_h3_test_client:close(QConn),
catch ssl:close(Sock),
ssl:close(Sock),

MRef = monitor(process, Pid),
nhttp:stop(Pid),
Expand Down
2 changes: 1 addition & 1 deletion test/nhttp_registry_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ end_per_testcase(_TestCase, _Config) ->
lists:foreach(
fun(Pid) ->
case is_pid(Pid) andalso is_process_alive(Pid) of
true -> catch nhttp:stop(Pid);
true -> nhttp:stop(Pid);
false -> ok
end
end,
Expand Down
Loading
Loading