aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch_acceptor.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-12-24 16:16:00 +0100
committerLoïc Hoguin <[email protected]>2012-12-24 16:16:00 +0100
commit201a0cb5e421e24ffcce0d6315b2190d103bcb06 (patch)
tree796f28b22ab6b2315717ede3eb391f2a71c6cfe1 /src/ranch_acceptor.erl
parent9993923c40b96ab07752ec36692dc09c4c7648e9 (diff)
downloadranch-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_acceptor.erl')
-rw-r--r--src/ranch_acceptor.erl6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ranch_acceptor.erl b/src/ranch_acceptor.erl
index 1985826..aef98d7 100644
--- a/src/ranch_acceptor.erl
+++ b/src/ranch_acceptor.erl
@@ -43,7 +43,7 @@ init(LSocket, Transport, Protocol, MaxConns, Opts, ListenerPid, ConnsSup) ->
loop(LSocket, Transport, Protocol, MaxConns, Opts, ListenerPid, ConnsSup).
-spec loop(inet:socket(), module(), module(),
- non_neg_integer(), any(), pid(), pid()) -> no_return().
+ ranch:max_conns(), any(), pid(), pid()) -> no_return().
loop(LSocket, Transport, Protocol, MaxConns, Opts, ListenerPid, ConnsSup) ->
receive
%% We couldn't accept the socket but it's safe to continue.
@@ -70,8 +70,8 @@ loop(LSocket, Transport, Protocol, MaxConns, Opts, ListenerPid, ConnsSup) ->
MaxConns, Opts2, ListenerPid, ConnsSup)
end.
--spec maybe_wait(pid(), non_neg_integer(), non_neg_integer())
- -> {ok, non_neg_integer()}.
+-spec maybe_wait(pid(), MaxConns, non_neg_integer())
+ -> {ok, MaxConns} when MaxConns::ranch:max_conns().
maybe_wait(_, MaxConns, NbConns) when MaxConns > NbConns ->
{ok, MaxConns};
maybe_wait(ListenerPid, MaxConns, NbConns) ->