aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ranch_acceptor.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ranch_acceptor.erl b/src/ranch_acceptor.erl
index 2120788..c90d877 100644
--- a/src/ranch_acceptor.erl
+++ b/src/ranch_acceptor.erl
@@ -15,16 +15,21 @@
-module(ranch_acceptor).
-export([start_link/5]).
+-export([init/4]).
-export([loop/5]).
-spec start_link(ranch:ref(), pos_integer(), inet:socket(), module(), module())
-> {ok, pid()}.
start_link(Ref, AcceptorId, LSocket, Transport, Logger) ->
ConnsSup = ranch_server:get_connections_sup(Ref, AcceptorId),
- MonitorRef = monitor(process, ConnsSup),
- Pid = spawn_link(?MODULE, loop, [LSocket, Transport, Logger, ConnsSup, MonitorRef]),
+ Pid = spawn_link(?MODULE, init, [LSocket, Transport, Logger, ConnsSup]),
{ok, Pid}.
+-spec init(inet:socket(), module(), module(), pid()) -> no_return().
+init(LSocket, Transport, Logger, ConnsSup) ->
+ MonitorRef = monitor(process, ConnsSup),
+ loop(LSocket, Transport, Logger, ConnsSup, MonitorRef).
+
-spec loop(inet:socket(), module(), module(), pid(), reference()) -> no_return().
loop(LSocket, Transport, Logger, ConnsSup, MonitorRef) ->
_ = case Transport:accept(LSocket, infinity) of