aboutsummaryrefslogtreecommitdiffstats
path: root/test/acceptor_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-12-24 16:09:40 +0100
committerLoïc Hoguin <[email protected]>2012-12-24 16:09:40 +0100
commit9993923c40b96ab07752ec36692dc09c4c7648e9 (patch)
tree7df91a8df7f0ef5ee4a6883e723fe0d86fa9ff83 /test/acceptor_SUITE.erl
parent058ad09e8b2c885a0888bda47459acd32ece917e (diff)
downloadranch-9993923c40b96ab07752ec36692dc09c4c7648e9.tar.gz
ranch-9993923c40b96ab07752ec36692dc09c4c7648e9.tar.bz2
ranch-9993923c40b96ab07752ec36692dc09c4c7648e9.zip
Add ranch:set_max_connections/2 and get_max_connections/1
Diffstat (limited to 'test/acceptor_SUITE.erl')
-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,