diff options
author | juhlig <[email protected]> | 2019-05-08 15:05:27 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-05-08 16:38:47 +0200 |
commit | d59eef5c737d0b08eb8c16c5316300e863bc935c (patch) | |
tree | be6ab3327717f847677484edf027af9e21266045 /src/ranch_conns_sup_sup.erl | |
parent | aa64151149e947145728a1f1339c689f1100720e (diff) | |
download | ranch-d59eef5c737d0b08eb8c16c5316300e863bc935c.tar.gz ranch-d59eef5c737d0b08eb8c16c5316300e863bc935c.tar.bz2 ranch-d59eef5c737d0b08eb8c16c5316300e863bc935c.zip |
Add the num_conns_sups option
This new option allows configuring the number of connection
supervisors. The old behavior can be obtained by setting this
value to 1. A value larger than num_acceptors will result in
some connection supervisors not being used as the acceptors
currently only use one connection supervisor.
Diffstat (limited to 'src/ranch_conns_sup_sup.erl')
-rw-r--r-- | src/ranch_conns_sup_sup.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ranch_conns_sup_sup.erl b/src/ranch_conns_sup_sup.erl index 423c5db..142b9de 100644 --- a/src/ranch_conns_sup_sup.erl +++ b/src/ranch_conns_sup_sup.erl @@ -19,16 +19,17 @@ -export([start_link/4]). -export([init/1]). -start_link(Ref, NumAcceptors, Transport, Protocol) -> +-spec start_link(ranch:ref(), pos_integer(), ranch:opts(), module()) -> {ok, pid()}. +start_link(Ref, NumConnsSups, Transport, Protocol) -> ok = ranch_server:cleanup_connections_sups(Ref), supervisor:start_link(?MODULE, { - Ref, NumAcceptors, Transport, Protocol + Ref, NumConnsSups, Transport, Protocol }). -init({Ref, NumAcceptors, Transport, Protocol}) -> +init({Ref, NumConnsSups, Transport, Protocol}) -> ChildSpecs = [ {{ranch_conns_sup, N}, {ranch_conns_sup, start_link, [Ref, N, Transport, Protocol]}, permanent, infinity, supervisor, [ranch_conns_sup]} - || N <- lists:seq(1, NumAcceptors)], + || N <- lists:seq(1, NumConnsSups)], {ok, {{one_for_one, 1, 5}, ChildSpecs}}. |