aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch_conns_sup.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ranch_conns_sup.erl')
-rw-r--r--src/ranch_conns_sup.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ranch_conns_sup.erl b/src/ranch_conns_sup.erl
index f3a6a0c..008b02b 100644
--- a/src/ranch_conns_sup.erl
+++ b/src/ranch_conns_sup.erl
@@ -111,7 +111,7 @@ loop(State=#state{parent=Parent, ref=Ref, conn_type=ConnType,
max_conns=MaxConns}, CurConns, NbChildren, Sleepers) ->
receive
{?MODULE, start_protocol, To, Socket} ->
- case Protocol:start_link(Ref, Socket, Transport, Opts) of
+ try Protocol:start_link(Ref, Socket, Transport, Opts) of
{ok, Pid} ->
shoot(State, CurConns, NbChildren, Sleepers, To, Socket, Pid, Pid);
{ok, SupPid, ProtocolPid} when ConnType =:= supervisor ->
@@ -124,6 +124,13 @@ loop(State=#state{parent=Parent, ref=Ref, conn_type=ConnType,
[Ref, Protocol, Ret]),
Transport:close(Socket),
loop(State, CurConns, NbChildren, Sleepers)
+ catch Class:Reason ->
+ To ! self(),
+ error_logger:error_msg(
+ "Ranch listener ~p connection process start failure; "
+ "~p:start_link/4 crashed with reason: ~p:~999999p~n",
+ [Ref, Protocol, Class, Reason]),
+ loop(State, CurConns, NbChildren, Sleepers)
end;
{?MODULE, active_connections, To, Tag} ->
To ! {Tag, CurConns},