mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 12:40:25 +00:00
Use the type ranch:ref() instead of any() where applicable
This commit is contained in:
parent
3d2f7218c5
commit
bb89bf6f8d
2 changed files with 6 additions and 6 deletions
|
@ -37,7 +37,7 @@
|
||||||
-export_type([onresponse_fun/0]).
|
-export_type([onresponse_fun/0]).
|
||||||
|
|
||||||
%% @doc Start an HTTP listener.
|
%% @doc Start an HTTP listener.
|
||||||
-spec start_http(any(), non_neg_integer(), any(),
|
-spec start_http(ranch:ref(), non_neg_integer(), any(),
|
||||||
cowboy_protocol:opts()) -> {ok, pid()}.
|
cowboy_protocol:opts()) -> {ok, pid()}.
|
||||||
start_http(Ref, NbAcceptors, TransOpts, ProtoOpts)
|
start_http(Ref, NbAcceptors, TransOpts, ProtoOpts)
|
||||||
when is_integer(NbAcceptors), NbAcceptors > 0 ->
|
when is_integer(NbAcceptors), NbAcceptors > 0 ->
|
||||||
|
@ -45,7 +45,7 @@ start_http(Ref, NbAcceptors, TransOpts, ProtoOpts)
|
||||||
ranch_tcp, TransOpts, cowboy_protocol, ProtoOpts).
|
ranch_tcp, TransOpts, cowboy_protocol, ProtoOpts).
|
||||||
|
|
||||||
%% @doc Start an HTTPS listener.
|
%% @doc Start an HTTPS listener.
|
||||||
-spec start_https(any(), non_neg_integer(), any(),
|
-spec start_https(ranch:ref(), non_neg_integer(), any(),
|
||||||
cowboy_protocol:opts()) -> {ok, pid()}.
|
cowboy_protocol:opts()) -> {ok, pid()}.
|
||||||
start_https(Ref, NbAcceptors, TransOpts, ProtoOpts)
|
start_https(Ref, NbAcceptors, TransOpts, ProtoOpts)
|
||||||
when is_integer(NbAcceptors), NbAcceptors > 0 ->
|
when is_integer(NbAcceptors), NbAcceptors > 0 ->
|
||||||
|
@ -53,7 +53,7 @@ start_https(Ref, NbAcceptors, TransOpts, ProtoOpts)
|
||||||
ranch_ssl, TransOpts, cowboy_protocol, ProtoOpts).
|
ranch_ssl, TransOpts, cowboy_protocol, ProtoOpts).
|
||||||
|
|
||||||
%% @doc Stop a listener.
|
%% @doc Stop a listener.
|
||||||
-spec stop_listener(any()) -> ok.
|
-spec stop_listener(ranch:ref()) -> ok.
|
||||||
stop_listener(Ref) ->
|
stop_listener(Ref) ->
|
||||||
ranch:stop_listener(Ref).
|
ranch:stop_listener(Ref).
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ stop_listener(Ref) ->
|
||||||
%% Allows you to update live an environment value used by middlewares.
|
%% Allows you to update live an environment value used by middlewares.
|
||||||
%% This function is primarily intended to simplify updating the dispatch
|
%% This function is primarily intended to simplify updating the dispatch
|
||||||
%% list used for routing.
|
%% list used for routing.
|
||||||
-spec set_env(any(), atom(), any()) -> ok.
|
-spec set_env(ranch:ref(), atom(), any()) -> ok.
|
||||||
set_env(Ref, Name, Value) ->
|
set_env(Ref, Name, Value) ->
|
||||||
Opts = ranch:get_protocol_options(Ref),
|
Opts = ranch:get_protocol_options(Ref),
|
||||||
{_, Env} = lists:keyfind(env, 1, Opts),
|
{_, Env} = lists:keyfind(env, 1, Opts),
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
%% @doc Start an HTTP protocol process.
|
%% @doc Start an HTTP protocol process.
|
||||||
-spec start_link(any(), inet:socket(), module(), opts()) -> {ok, pid()}.
|
-spec start_link(ranch:ref(), inet:socket(), module(), opts()) -> {ok, pid()}.
|
||||||
start_link(Ref, Socket, Transport, Opts) ->
|
start_link(Ref, Socket, Transport, Opts) ->
|
||||||
Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts]),
|
Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts]),
|
||||||
{ok, Pid}.
|
{ok, Pid}.
|
||||||
|
@ -108,7 +108,7 @@ get_value(Key, Opts, Default) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
-spec init(any(), inet:socket(), module(), opts()) -> ok.
|
-spec init(ranch:ref(), inet:socket(), module(), opts()) -> ok.
|
||||||
init(Ref, Socket, Transport, Opts) ->
|
init(Ref, Socket, Transport, Opts) ->
|
||||||
Compress = get_value(compress, Opts, false),
|
Compress = get_value(compress, Opts, false),
|
||||||
MaxEmptyLines = get_value(max_empty_lines, Opts, 5),
|
MaxEmptyLines = get_value(max_empty_lines, Opts, 5),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue