diff options
Diffstat (limited to 'src/cowboy_protocol.erl')
-rw-r--r-- | src/cowboy_protocol.erl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl index 78e3b78..be351b7 100644 --- a/src/cowboy_protocol.erl +++ b/src/cowboy_protocol.erl @@ -84,9 +84,9 @@ %% API. %% @doc Start an HTTP protocol process. --spec start_link(pid(), inet:socket(), module(), any()) -> {ok, pid()}. -start_link(ListenerPid, Socket, Transport, Opts) -> - Pid = spawn_link(?MODULE, init, [ListenerPid, Socket, Transport, Opts]), +-spec start_link(any(), inet:socket(), module(), any()) -> {ok, pid()}. +start_link(Ref, Socket, Transport, Opts) -> + Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts]), {ok, Pid}. %% Internal. @@ -100,8 +100,8 @@ get_value(Key, Opts, Default) -> end. %% @private --spec init(pid(), inet:socket(), module(), any()) -> ok. -init(ListenerPid, Socket, Transport, Opts) -> +-spec init(any(), inet:socket(), module(), any()) -> ok. +init(Ref, Socket, Transport, Opts) -> Compress = get_value(compress, Opts, false), MaxEmptyLines = get_value(max_empty_lines, Opts, 5), MaxHeaderNameLength = get_value(max_header_name_length, Opts, 64), @@ -110,11 +110,11 @@ init(ListenerPid, Socket, Transport, Opts) -> MaxKeepalive = get_value(max_keepalive, Opts, 100), MaxRequestLineLength = get_value(max_request_line_length, Opts, 4096), Middlewares = get_value(middlewares, Opts, [cowboy_router, cowboy_handler]), - Env = [{listener, ListenerPid}|get_value(env, Opts, [])], + Env = [{listener, Ref}|get_value(env, Opts, [])], OnRequest = get_value(onrequest, Opts, undefined), OnResponse = get_value(onresponse, Opts, undefined), Timeout = get_value(timeout, Opts, 5000), - ok = ranch:accept_ack(ListenerPid), + ok = ranch:accept_ack(Ref), wait_request(<<>>, #state{socket=Socket, transport=Transport, middlewares=Middlewares, compress=Compress, env=Env, max_empty_lines=MaxEmptyLines, max_keepalive=MaxKeepalive, |