From b72fe3e67e65c66d979a9651ebc815bdc553601c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 24 Jul 2012 12:58:54 +0200 Subject: Introduce the ranch_server registry, make it handle listeners --- src/ranch_listener_sup.erl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ranch_listener_sup.erl') diff --git a/src/ranch_listener_sup.erl b/src/ranch_listener_sup.erl index 63e3ffe..b42732d 100644 --- a/src/ranch_listener_sup.erl +++ b/src/ranch_listener_sup.erl @@ -17,21 +17,22 @@ -behaviour(supervisor). %% API. --export([start_link/5]). +-export([start_link/6]). %% supervisor. -export([init/1]). %% API. --spec start_link(non_neg_integer(), module(), any(), module(), any()) +-spec start_link(any(), non_neg_integer(), module(), any(), module(), any()) -> {ok, pid()}. -start_link(NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> +start_link(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> MaxConns = proplists:get_value(max_connections, TransOpts, 1024), {ok, SupPid} = supervisor:start_link(?MODULE, []), {ok, ListenerPid} = supervisor:start_child(SupPid, {ranch_listener, {ranch_listener, start_link, [MaxConns, ProtoOpts]}, permanent, 5000, worker, [ranch_listener]}), + ok = ranch_server:insert_listener(Ref, ListenerPid), {ok, ConnsPid} = supervisor:start_child(SupPid, {ranch_conns_sup, {ranch_conns_sup, start_link, []}, permanent, 5000, supervisor, [ranch_conns_sup]}), -- cgit v1.2.3