|
@@ -39,6 +39,11 @@ loop(LSocket, Transport, ConnsSup) ->
|
|
|
%% This call will not return until process has been started
|
|
|
%% AND we are below the maximum number of connections.
|
|
|
ranch_conns_sup:start_protocol(ConnsSup, CSocket);
|
|
|
+ %% Reduce the accept rate if we run out of file descriptors.
|
|
|
+ %% We can't accept anymore anyway, so we might as well wait
|
|
|
+ %% a little for the situation to resolve itself.
|
|
|
+ {error, emfile} ->
|
|
|
+ receive after 100 -> ok end;
|
|
|
%% We want to crash if the listening socket got closed.
|
|
|
{error, Reason} when Reason =/= closed ->
|
|
|
ok
|