aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ranch_acceptor.erl5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ranch_acceptor.erl b/src/ranch_acceptor.erl
index 44cf52d..f838b7d 100644
--- a/src/ranch_acceptor.erl
+++ b/src/ranch_acceptor.erl
@@ -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