diff options
author | Loïc Hoguin <[email protected]> | 2012-12-24 16:16:00 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-12-24 16:16:00 +0100 |
commit | 201a0cb5e421e24ffcce0d6315b2190d103bcb06 (patch) | |
tree | 796f28b22ab6b2315717ede3eb391f2a71c6cfe1 /src/ranch_listener.erl | |
parent | 9993923c40b96ab07752ec36692dc09c4c7648e9 (diff) | |
download | ranch-201a0cb5e421e24ffcce0d6315b2190d103bcb06.tar.gz ranch-201a0cb5e421e24ffcce0d6315b2190d103bcb06.tar.bz2 ranch-201a0cb5e421e24ffcce0d6315b2190d103bcb06.zip |
Improve max_connections type
It is non_neg_integer() | infinity. Introduce the type
`ranch:max_conns/0` for easier manipulation.
Diffstat (limited to 'src/ranch_listener.erl')
-rw-r--r-- | src/ranch_listener.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ranch_listener.erl b/src/ranch_listener.erl index 873d860..81943d4 100644 --- a/src/ranch_listener.erl +++ b/src/ranch_listener.erl @@ -38,7 +38,7 @@ -record(state, { ref :: any(), - max_conns = undefined :: non_neg_integer(), + max_conns = undefined :: ranch:max_conns(), port = undefined :: undefined | inet:port_number(), proto_opts = undefined :: any(), rm_diff = 0 :: non_neg_integer() @@ -83,12 +83,12 @@ set_port(ServerPid, Port) -> gen_server:cast(ServerPid, {set_port, Port}). %% @doc Return the max number of connections allowed concurrently. --spec get_max_connections(pid()) -> {ok, non_neg_integer()}. +-spec get_max_connections(pid()) -> {ok, ranch:max_conns()}. get_max_connections(ServerPid) -> gen_server:call(ServerPid, get_max_connections). %% @doc Set the max number of connections allowed concurrently. --spec set_max_connections(pid(), non_neg_integer()) -> ok. +-spec set_max_connections(pid(), ranch:max_conns()) -> ok. set_max_connections(ServerPid, MaxConnections) -> gen_server:call(ServerPid, {set_max_connections, MaxConnections}). |