Permalink
Browse files

Update Ranch to 0.8.0

  • Loading branch information...
1 parent ce1d886 commit 2b56bb498f82860fb8783a7ee4d69a1d5696c5c9 @essen essen committed Apr 3, 2013
Showing with 13 additions and 13 deletions.
  1. +1 −1 Makefile
  2. +1 −1 examples/elixir_hello_world/mix.exs
  3. +1 −1 guide/middlewares.md
  4. +1 −1 rebar.config
  5. +7 −7 src/cowboy_protocol.erl
  6. +2 −2 src/cowboy_websocket.erl
View
@@ -1,7 +1,7 @@
# See LICENSE for licensing information.
PROJECT = cowboy
-RANCH_VSN = 0.6.2
+RANCH_VSN = 0.8.0
ERLC_OPTS ?= -Werror +debug_info +warn_export_all +warn_export_vars \
+warn_shadow_vars +warn_obsolete_guard # +bin_opt_info +warn_missing_spec
@@ -14,7 +14,7 @@ defmodule ElixirHelloWorld.Mixfile do
end
defp deps do
- [ {:ranch, github: "extend/ranch", tag: "0.6.2"},
+ [ {:ranch, github: "extend/ranch", tag: "0.8.0"},
{:cowboy, github: "extend/cowboy"} ]
end
end
View
@@ -48,7 +48,7 @@ the routing information. It is a list of tuples with the first
element being an atom and the second any Erlang term.
Two values in the environment are reserved:
- * `listener` contains the pid of the listener process
+ * `listener` contains the name of the listener
* `result` contains the result of the processing
The `listener` value is always defined. The `result` value can be
View
@@ -1,3 +1,3 @@
{deps, [
- {ranch, ".*", {git, "git://github.com/extend/ranch.git", "0.6.2"}}
+ {ranch, ".*", {git, "git://github.com/extend/ranch.git", "0.8.0"}}
]}.
View
@@ -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,
View
@@ -63,8 +63,8 @@
| {suspend, module(), atom(), [any()]}
when Req::cowboy_req:req(), Env::cowboy_middleware:env().
upgrade(Req, Env, Handler, HandlerOpts) ->
- {_, ListenerPid} = lists:keyfind(listener, 1, Env),
- ranch_listener:remove_connection(ListenerPid),
+ {_, Ref} = lists:keyfind(listener, 1, Env),
+ ranch:remove_connection(Ref),
[Socket, Transport] = cowboy_req:get([socket, transport], Req),
State = #state{env=Env, socket=Socket, transport=Transport,
handler=Handler, handler_opts=HandlerOpts},

0 comments on commit 2b56bb4

Please sign in to comment.