From 1db8290685e9cff3dfafde62de6148246075990a Mon Sep 17 00:00:00 2001 From: Jose M Perez Date: Sun, 1 Sep 2019 22:11:21 +0200 Subject: Removed connections trigger acceptors wake-up --- test/acceptor_SUITE.erl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl index 8748201..2c8b9e2 100644 --- a/test/acceptor_SUITE.erl +++ b/test/acceptor_SUITE.erl @@ -40,6 +40,7 @@ groups() -> tcp_max_connections_and_beyond, tcp_max_connections_infinity, tcp_remove_connections, + tcp_remove_connections_acceptor_wakeup, tcp_set_max_connections, tcp_set_max_connections_clean, tcp_getopts_capability, @@ -974,6 +975,24 @@ tcp_remove_connections(_) -> 0 = ranch_server:count_connections(Name), ok = ranch:stop_listener(Name). +tcp_remove_connections_acceptor_wakeup(_) -> + doc("Ensure that removed connections wake up acceptors."), + Name = name(), + {ok, _} = ranch:start_listener(Name, + ranch_tcp, #{max_connections => 1, num_acceptors => 1}, + remove_conn_and_wait_protocol, [{remove, true, infinity}]), + Port = ranch:get_port(Name), + ConnectOptions = [binary, {active, false}], + Localhost = "localhost", + {ok, Socket1} = gen_tcp:connect(Localhost, Port, ConnectOptions), + {ok, Socket2} = gen_tcp:connect(Localhost, Port, ConnectOptions), + {ok, Socket3} = gen_tcp:connect(Localhost, Port, ConnectOptions), + ok = gen_tcp:send(Socket3, <<"bye">>), + true = maps:get(all_connections, ranch:info(Name)) >= 2, + ok = gen_tcp:send(Socket1, <<"bye">>), + ok = gen_tcp:send(Socket2, <<"bye">>), + ok = ranch:stop_listener(Name). + tcp_set_max_connections(_) -> doc("Ensure that changing the max_connections option to a larger value allows for more connections."), Name = name(), -- cgit v1.2.3