Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Some API for detecting bind errors #51

Closed
maxlapshin opened this Issue Apr 30, 2013 · 4 comments

Comments

Projects
None yet
2 participants

When I start ranch acceptor, there may be errors like {error, eaccess} or {error, eaddrinuse}.

There is no way to catch this error in upper application and make proper user request.

I think it would be good to have some API like:

case ranch:start(...) of
  {ok, _} -> ok;
  {error, eaccess} -> error_logger:error_msg("Bind to privileged port");
  {error, eaddrinuse} -> error_logger:error_msg("Port is used")
end 
Owner

essen commented Nov 25, 2013

That's not going to be done. However you can use the socket option to first bind the socket and only after start the listener. The transport options would be [{socket, Socket}] instead of what you currently use.

Why don't you want to add some API for checking errors on start?

Owner

essen commented Nov 25, 2013

Because there is no interest, and there is already a much simpler alternative than trying to parse the mess of errors the supervisor start failure would give us.

Owner

essen commented Dec 4, 2013

Closing, thanks.

@essen essen closed this Dec 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment