diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ranch_acceptors_sup.erl | 10 | ||||
-rw-r--r-- | src/ranch_conns_sup_sup.erl | 12 | ||||
-rw-r--r-- | src/ranch_listener_sup.erl | 18 | ||||
-rw-r--r-- | src/ranch_sup.erl | 5 |
4 files changed, 24 insertions, 21 deletions
diff --git a/src/ranch_acceptors_sup.erl b/src/ranch_acceptors_sup.erl index cba563e..6a89d5a 100644 --- a/src/ranch_acceptors_sup.erl +++ b/src/ranch_acceptors_sup.erl @@ -38,13 +38,13 @@ init([Ref, NumAcceptors, Transport]) -> Procs = [begin LSocketId = (AcceptorId rem NumListenSockets) + 1, {_, LSocket} = lists:keyfind(LSocketId, 1, LSockets), - { - {acceptor, self(), AcceptorId}, - {ranch_acceptor, start_link, [Ref, AcceptorId, LSocket, Transport, Logger]}, - permanent, brutal_kill, worker, [] + #{ + id => {acceptor, self(), AcceptorId}, + start => {ranch_acceptor, start_link, [Ref, AcceptorId, LSocket, Transport, Logger]}, + shutdown => brutal_kill } end || AcceptorId <- lists:seq(1, NumAcceptors)], - {ok, {{one_for_one, 1, 5}, Procs}}. + {ok, {#{}, Procs}}. -spec start_listen_sockets(any(), pos_integer(), module(), list(), module()) -> [{pos_integer(), inet:socket()}]. diff --git a/src/ranch_conns_sup_sup.erl b/src/ranch_conns_sup_sup.erl index 142b9de..334948c 100644 --- a/src/ranch_conns_sup_sup.erl +++ b/src/ranch_conns_sup_sup.erl @@ -27,9 +27,9 @@ start_link(Ref, NumConnsSups, 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, NumConnsSups)], - {ok, {{one_for_one, 1, 5}, ChildSpecs}}. + ChildSpecs = [#{ + id => {ranch_conns_sup, N}, + start => {ranch_conns_sup, start_link, [Ref, N, Transport, Protocol]}, + type => supervisor + } || N <- lists:seq(1, NumConnsSups)], + {ok, {#{}, ChildSpecs}}. diff --git a/src/ranch_listener_sup.erl b/src/ranch_listener_sup.erl index bf533a9..312b6fc 100644 --- a/src/ranch_listener_sup.erl +++ b/src/ranch_listener_sup.erl @@ -33,11 +33,15 @@ start_link(Ref, Transport, TransOpts, Protocol, ProtoOpts) -> init({Ref, NumAcceptors, NumConnsSups, Transport, Protocol}) -> ok = ranch_server:set_listener_sup(Ref, self()), ChildSpecs = [ - {ranch_conns_sup_sup, {ranch_conns_sup_sup, start_link, - [Ref, NumConnsSups, Transport, Protocol]}, - permanent, infinity, supervisor, [ranch_conns_sup_sup]}, - {ranch_acceptors_sup, {ranch_acceptors_sup, start_link, - [Ref, NumAcceptors, Transport]}, - permanent, infinity, supervisor, [ranch_acceptors_sup]} + #{ + id => ranch_conns_sup_sup, + start => {ranch_conns_sup_sup, start_link, [Ref, NumConnsSups, Transport, Protocol]}, + type => supervisor + }, + #{ + id => ranch_acceptors_sup, + start => {ranch_acceptors_sup, start_link, [Ref, NumAcceptors, Transport]}, + type => supervisor + } ], - {ok, {{rest_for_one, 1, 5}, ChildSpecs}}. + {ok, {#{strategy => rest_for_one}, ChildSpecs}}. diff --git a/src/ranch_sup.erl b/src/ranch_sup.erl index 3cb0cd6..1d100db 100644 --- a/src/ranch_sup.erl +++ b/src/ranch_sup.erl @@ -34,7 +34,6 @@ init([]) -> ranch_server = ets:new(ranch_server, [ ordered_set, public, named_table]), Procs = [ - {ranch_server, {ranch_server, start_link, []}, - permanent, 5000, worker, [ranch_server]} + #{id => ranch_server, start => {ranch_server, start_link, []}} ], - {ok, {{one_for_one, Intensity, Period}, Procs}}. + {ok, {#{intensity => Intensity, period => Period}, Procs}}. |