aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch_acceptors_sup.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-07-25 11:40:30 +0200
committerLoïc Hoguin <[email protected]>2012-07-25 21:26:15 +0200
commit7d52280c2e3fcc9e1b89435c98ef96d4758aed7a (patch)
tree0aed63afc8c19c822748ef439c65239a8f4e707d /src/ranch_acceptors_sup.erl
parent1d2940b37917a9217338caa4dea37890ac5b96d3 (diff)
downloadranch-7d52280c2e3fcc9e1b89435c98ef96d4758aed7a.tar.gz
ranch-7d52280c2e3fcc9e1b89435c98ef96d4758aed7a.tar.bz2
ranch-7d52280c2e3fcc9e1b89435c98ef96d4758aed7a.zip
Make acceptors query the protocol opts on startup
This way, if a crash happens in one of them after a protocol options upgrade has occured, the restarted acceptor will get the upgraded options as expected, and not the initial ones.
Diffstat (limited to 'src/ranch_acceptors_sup.erl')
-rw-r--r--src/ranch_acceptors_sup.erl20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ranch_acceptors_sup.erl b/src/ranch_acceptors_sup.erl
index 8cdef17..2e45acf 100644
--- a/src/ranch_acceptors_sup.erl
+++ b/src/ranch_acceptors_sup.erl
@@ -17,7 +17,7 @@
-behaviour(supervisor).
%% API.
--export([start_link/8]).
+-export([start_link/7]).
%% supervisor.
-export([init/1]).
@@ -25,22 +25,22 @@
%% API.
-spec start_link(any(), non_neg_integer(), module(), any(),
- module(), any(), pid(), pid()) -> {ok, pid()}.
+ module(), pid(), pid()) -> {ok, pid()}.
start_link(Ref, NbAcceptors, Transport, TransOpts,
- Protocol, ProtoOpts, ListenerPid, ConnsPid) ->
+ Protocol, ListenerPid, ConnsPid) ->
supervisor:start_link(?MODULE, [Ref, NbAcceptors, Transport, TransOpts,
- Protocol, ProtoOpts, ListenerPid, ConnsPid]).
+ Protocol, ListenerPid, ConnsPid]).
%% supervisor.
init([Ref, NbAcceptors, Transport, TransOpts,
- Protocol, ProtoOpts, ListenerPid, ConnsPid]) ->
+ Protocol, ListenerPid, ConnsPid]) ->
{ok, LSocket} = Transport:listen(TransOpts),
{ok, {_, Port}} = Transport:sockname(LSocket),
ranch_listener:set_port(ListenerPid, Port),
- Procs = [{{acceptor, self(), N}, {ranch_acceptor, start_link, [
- Ref, LSocket, Transport, Protocol, ProtoOpts,
- ListenerPid, ConnsPid
- ]}, permanent, brutal_kill, worker, []}
- || N <- lists:seq(1, NbAcceptors)],
+ Procs = [
+ {{acceptor, self(), N}, {ranch_acceptor, start_link, [
+ Ref, LSocket, Transport, Protocol, ListenerPid, ConnsPid
+ ]}, permanent, brutal_kill, worker, []}
+ || N <- lists:seq(1, NbAcceptors)],
{ok, {{one_for_one, 10, 10}, Procs}}.