aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/manual/ranch.asciidoc8
-rw-r--r--src/ranch.erl12
-rw-r--r--src/ranch_acceptors_sup.erl8
-rw-r--r--src/ranch_listener_sup.erl8
4 files changed, 18 insertions, 18 deletions
diff --git a/doc/src/manual/ranch.asciidoc b/doc/src/manual/ranch.asciidoc
index 22ab159..2e4f177 100644
--- a/doc/src/manual/ranch.asciidoc
+++ b/doc/src/manual/ranch.asciidoc
@@ -68,10 +68,10 @@ This function MUST be used by a connection process to inform
Ranch that it initialized properly and let it perform any
additional operations before the socket can be safely used.
-=== child_spec(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> supervisor:child_spec()
+=== child_spec(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> supervisor:child_spec()
Ref = ref():: Listener name.
-NbAcceptors = non_neg_integer():: Number of acceptor processes.
+NumAcceptors = non_neg_integer():: Number of acceptor processes.
Transport = module():: Transport module.
TransOpts = any():: Transport options.
Protocol = module():: Protocol module.
@@ -145,10 +145,10 @@ Set the protocol options for the given listener.
The change will be applied immediately for all new connections.
Old connections will not receive the new options.
-=== start_listener(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> {ok, pid()} | {error, badarg}
+=== start_listener(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> {ok, pid()} | {error, badarg}
Ref = ref():: Listener name.
-NbAcceptors = non_neg_integer():: Number of acceptor processes.
+NumAcceptors = non_neg_integer():: Number of acceptor processes.
Transport = module():: Transport module.
TransOpts = any():: Transport options.
Protocol = module():: Protocol module.
diff --git a/src/ranch.erl b/src/ranch.erl
index 32a0be6..43e940a 100644
--- a/src/ranch.erl
+++ b/src/ranch.erl
@@ -44,8 +44,8 @@
-spec start_listener(ref(), non_neg_integer(), module(), any(), module(), any())
-> supervisor:startchild_ret().
-start_listener(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts)
- when is_integer(NbAcceptors) andalso is_atom(Transport)
+start_listener(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts)
+ when is_integer(NumAcceptors) andalso is_atom(Transport)
andalso is_atom(Protocol) ->
_ = code:ensure_loaded(Transport),
%% @todo Remove in Ranch 2.0 and simply require ssl.
@@ -54,7 +54,7 @@ start_listener(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts)
false ->
{error, badarg};
true ->
- Res = supervisor:start_child(ranch_sup, child_spec(Ref, NbAcceptors,
+ Res = supervisor:start_child(ranch_sup, child_spec(Ref, NumAcceptors,
Transport, TransOpts, Protocol, ProtoOpts)),
Socket = proplists:get_value(socket, TransOpts),
case Res of
@@ -89,13 +89,13 @@ stop_listener(Ref) ->
-spec child_spec(ref(), non_neg_integer(), module(), any(), module(), any())
-> supervisor:child_spec().
-child_spec(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts)
- when is_integer(NbAcceptors) andalso is_atom(Transport)
+child_spec(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts)
+ when is_integer(NumAcceptors) andalso is_atom(Transport)
andalso is_atom(Protocol) ->
%% @todo Remove in Ranch 2.0 and simply require ssl.
_ = ensure_ssl(Transport),
{{ranch_listener_sup, Ref}, {ranch_listener_sup, start_link, [
- Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts
+ Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts
]}, permanent, infinity, supervisor, [ranch_listener_sup]}.
%% @todo Remove in Ranch 2.0 and simply require ssl.
diff --git a/src/ranch_acceptors_sup.erl b/src/ranch_acceptors_sup.erl
index 497ccfe..67854d5 100644
--- a/src/ranch_acceptors_sup.erl
+++ b/src/ranch_acceptors_sup.erl
@@ -20,10 +20,10 @@
-spec start_link(ranch:ref(), non_neg_integer(), module(), any())
-> {ok, pid()}.
-start_link(Ref, NbAcceptors, Transport, TransOpts) ->
- supervisor:start_link(?MODULE, [Ref, NbAcceptors, Transport, TransOpts]).
+start_link(Ref, NumAcceptors, Transport, TransOpts) ->
+ supervisor:start_link(?MODULE, [Ref, NumAcceptors, Transport, TransOpts]).
-init([Ref, NbAcceptors, Transport, TransOpts]) ->
+init([Ref, NumAcceptors, Transport, TransOpts]) ->
ConnsSup = ranch_server:get_connections_sup(Ref),
LSocket = case proplists:get_value(socket, TransOpts) of
undefined ->
@@ -45,7 +45,7 @@ init([Ref, NbAcceptors, Transport, TransOpts]) ->
{{acceptor, self(), N}, {ranch_acceptor, start_link, [
LSocket, Transport, ConnsSup
]}, permanent, brutal_kill, worker, []}
- || N <- lists:seq(1, NbAcceptors)],
+ || N <- lists:seq(1, NumAcceptors)],
{ok, {{one_for_one, 1, 5}, Procs}}.
-spec listen_error(any(), module(), any(), atom()) -> no_return().
diff --git a/src/ranch_listener_sup.erl b/src/ranch_listener_sup.erl
index 294cd1d..2f697d6 100644
--- a/src/ranch_listener_sup.erl
+++ b/src/ranch_listener_sup.erl
@@ -20,14 +20,14 @@
-spec start_link(ranch:ref(), non_neg_integer(), module(), any(), module(), any())
-> {ok, pid()}.
-start_link(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) ->
+start_link(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts) ->
MaxConns = proplists:get_value(max_connections, TransOpts, 1024),
ranch_server:set_new_listener_opts(Ref, MaxConns, ProtoOpts),
supervisor:start_link(?MODULE, {
- Ref, NbAcceptors, Transport, TransOpts, Protocol
+ Ref, NumAcceptors, Transport, TransOpts, Protocol
}).
-init({Ref, NbAcceptors, Transport, TransOpts, Protocol}) ->
+init({Ref, NumAcceptors, Transport, TransOpts, Protocol}) ->
AckTimeout = proplists:get_value(ack_timeout, TransOpts, 5000),
ConnType = proplists:get_value(connection_type, TransOpts, worker),
Shutdown = proplists:get_value(shutdown, TransOpts, 5000),
@@ -36,7 +36,7 @@ init({Ref, NbAcceptors, Transport, TransOpts, Protocol}) ->
[Ref, ConnType, Shutdown, Transport, AckTimeout, Protocol]},
permanent, infinity, supervisor, [ranch_conns_sup]},
{ranch_acceptors_sup, {ranch_acceptors_sup, start_link,
- [Ref, NbAcceptors, Transport, TransOpts]},
+ [Ref, NumAcceptors, Transport, TransOpts]},
permanent, infinity, supervisor, [ranch_acceptors_sup]}
],
{ok, {{rest_for_one, 1, 5}, ChildSpecs}}.