aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ranch_tcp.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ranch_tcp.erl b/src/ranch_tcp.erl
index b54ae70..11a0843 100644
--- a/src/ranch_tcp.erl
+++ b/src/ranch_tcp.erl
@@ -34,6 +34,14 @@
-export([sockname/1]).
-export([close/1]).
+-type opts() :: [{backlog, non_neg_integer()}
+ | {ip, inet:ip_address()}
+ | {nodelay, boolean()}
+ | {port, inet:port_number()}
+ | {raw, non_neg_integer(), non_neg_integer(),
+ non_neg_integer() | binary()}].
+-export_type([opts/0]).
+
%% @doc Name of this transport, <em>tcp</em>.
name() -> tcp.
@@ -62,9 +70,7 @@ messages() -> {tcp, tcp_closed, tcp_error}.
%% ranch:get_port/1 instead.
%%
%% @see gen_tcp:listen/2
--spec listen([{backlog, non_neg_integer()} | {ip, inet:ip_address()}
- | {nodelay, boolean()} | {port, inet:port_number()}])
- -> {ok, inet:socket()} | {error, atom()}.
+-spec listen(opts()) -> {ok, inet:socket()} | {error, atom()}.
listen(Opts) ->
Opts2 = ranch:set_option_default(Opts, backlog, 1024),
%% We set the port to 0 because it is given in the Opts directly.