aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ranch.erl')
-rw-r--r--src/ranch.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ranch.erl b/src/ranch.erl
index 7f751cf..9eb9a47 100644
--- a/src/ranch.erl
+++ b/src/ranch.erl
@@ -74,9 +74,20 @@ start_listener(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts)
_ ->
ok
end,
- Res
+ maybe_started(Res)
end.
+maybe_started({error, {{shutdown,
+ {failed_to_start_child, ranch_acceptors_sup,
+ {listen_error, _, Reason}}}, _}} = Error) ->
+ start_error(Reason, Error);
+maybe_started(Res) ->
+ Res.
+
+start_error(E=eaddrinuse, _) -> {error, E};
+start_error(E=no_cert, _) -> {error, E};
+start_error(_, Error) -> Error.
+
-spec stop_listener(ref()) -> ok | {error, not_found}.
stop_listener(Ref) ->
case supervisor:terminate_child(ranch_sup, {ranch_listener_sup, Ref}) of