aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_listener_sup.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-08-09 18:07:57 +0200
committerLoïc Hoguin <[email protected]>2011-08-10 16:43:59 +0200
commit56369d5c1a0a3141e9d136b2f8010ff0e96bb26c (patch)
treeb4387d0ad61a02348fcd7b64553bb048d6bebb47 /src/cowboy_listener_sup.erl
parent613890146539d08b52663b6e775b6f83492e29d4 (diff)
downloadcowboy-56369d5c1a0a3141e9d136b2f8010ff0e96bb26c.tar.gz
cowboy-56369d5c1a0a3141e9d136b2f8010ff0e96bb26c.tar.bz2
cowboy-56369d5c1a0a3141e9d136b2f8010ff0e96bb26c.zip
Introduce cowboy_listener for managing a listener
Currently only supports limiting the maximum number of connections by managing connection pools.
Diffstat (limited to 'src/cowboy_listener_sup.erl')
-rw-r--r--src/cowboy_listener_sup.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cowboy_listener_sup.erl b/src/cowboy_listener_sup.erl
index 0ed662f..adf5262 100644
--- a/src/cowboy_listener_sup.erl
+++ b/src/cowboy_listener_sup.erl
@@ -25,17 +25,21 @@
-> {ok, pid()}.
start_link(NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) ->
{ok, SupPid} = supervisor:start_link(?MODULE, []),
+ {ok, ListenerPid} = supervisor:start_child(SupPid,
+ {cowboy_listener, {cowboy_listener, start_link, []},
+ permanent, 5000, worker, dynamic}),
{ok, ReqsPid} = supervisor:start_child(SupPid,
{cowboy_requests_sup, {cowboy_requests_sup, start_link, []},
permanent, 5000, supervisor, [cowboy_requests_sup]}),
{ok, _PoolPid} = supervisor:start_child(SupPid,
{cowboy_acceptors_sup, {cowboy_acceptors_sup, start_link, [
- NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts, ReqsPid
+ NbAcceptors, Transport, TransOpts,
+ Protocol, ProtoOpts, ListenerPid, ReqsPid
]}, permanent, 5000, supervisor, [cowboy_acceptors_sup]}),
{ok, SupPid}.
%% supervisor.
--spec init([]) -> {ok, {{one_for_one, 0, 1}, []}}.
+-spec init([]) -> {ok, {{one_for_all, 10, 10}, []}}.
init([]) ->
- {ok, {{one_for_one, 0, 1}, []}}.
+ {ok, {{one_for_all, 10, 10}, []}}.