aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/acceptor_SUITE.erl17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl
index 582e564..f5db464 100644
--- a/test/acceptor_SUITE.erl
+++ b/test/acceptor_SUITE.erl
@@ -39,6 +39,7 @@
-export([tcp_echo/1]).
-export([tcp_max_connections/1]).
-export([tcp_max_connections_and_beyond/1]).
+-export([tcp_set_max_connections/1]).
-export([tcp_upgrade/1]).
%% supervisor.
@@ -58,6 +59,7 @@ groups() ->
tcp_echo,
tcp_max_connections,
tcp_max_connections_and_beyond,
+ tcp_set_max_connections,
tcp_upgrade
]}, {ssl, [
ssl_accept_error,
@@ -258,6 +260,21 @@ tcp_max_connections_and_beyond(_) ->
receive after 500 -> ok end,
10 = ranch_server:count_connections(ListenerPid).
+tcp_set_max_connections(_) ->
+ {ok, _} = ranch:start_listener(tcp_set_max_connections, 1,
+ ranch_tcp, [{port, 0}, {max_connections, 10}],
+ notify_and_wait_protocol, [{msg, connected}, {pid, self()}]),
+ Port = ranch:get_port(tcp_set_max_connections),
+ %% @todo We'll probably want a more direct interface to count_connections.
+ ListenerPid = ranch_server:lookup_listener(tcp_set_max_connections),
+ ok = connect_loop(Port, 20, 0),
+ 10 = ranch_server:count_connections(ListenerPid),
+ 10 = receive_loop(connected, 1000),
+ 10 = ranch:get_max_connections(tcp_set_max_connections),
+ ranch:set_max_connections(tcp_set_max_connections, 20),
+ 10 = receive_loop(connected, 1000),
+ 20 = ranch:get_max_connections(tcp_set_max_connections).
+
tcp_upgrade(_) ->
receive after 20000 -> ok end,
{ok, _} = ranch:start_listener(tcp_upgrade, 1,