aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch.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 /src/ranch.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 'src/ranch.erl')
-rw-r--r--src/ranch.erl15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ranch.erl b/src/ranch.erl
index 59e1fa7..c582efa 100644
--- a/src/ranch.erl
+++ b/src/ranch.erl
@@ -20,6 +20,8 @@
-export([child_spec/6]).
-export([accept_ack/1]).
-export([get_port/1]).
+-export([get_max_connections/1]).
+-export([set_max_connections/2]).
-export([get_protocol_options/1]).
-export([set_protocol_options/2]).
-export([filter_options/3]).
@@ -121,6 +123,19 @@ get_port(Ref) ->
{ok, Port} = ranch_listener:get_port(ListenerPid),
Port.
+%% @doc Return the max number of connections allowed concurrently.
+-spec get_max_connections(any()) -> non_neg_integer().
+get_max_connections(Ref) ->
+ ListenerPid = ranch_server:lookup_listener(Ref),
+ {ok, MaxConnections} = ranch_listener:get_max_connections(ListenerPid),
+ MaxConnections.
+
+%% @doc Set the max number of connections allowed concurrently.
+-spec set_max_connections(any(), non_neg_integer()) -> ok.
+set_max_connections(Ref, MaxConnections) ->
+ ListenerPid = ranch_server:lookup_listener(Ref),
+ ok = ranch_listener:set_max_connections(ListenerPid, MaxConnections).
+
%% @doc Return the current protocol options for the given listener.
-spec get_protocol_options(any()) -> any().
get_protocol_options(Ref) ->