diff options
author | Loïc Hoguin <[email protected]> | 2013-04-01 17:04:21 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-04-01 17:04:21 +0200 |
commit | 109c63d0e76ca6248863932c7a9957f8093cfaf2 (patch) | |
tree | 12682f0ec90e57a31ef2e35d67e5440aa0335edb /examples/tcp_echo/src/echo_protocol.erl | |
parent | 33db3b0d1aafcfbc9aadbad622a4014c021ef10c (diff) | |
download | ranch-109c63d0e76ca6248863932c7a9957f8093cfaf2.tar.gz ranch-109c63d0e76ca6248863932c7a9957f8093cfaf2.tar.bz2 ranch-109c63d0e76ca6248863932c7a9957f8093cfaf2.zip |
Remove ranch_listener and replace ListenerPid by Ref
We just don't need this process anymore. Less, simpler code!
API changes:
* Protocols start_link first argument is now Ref instead of ListenerPid
* ranch:accept_ack/1 argument is now Ref instead of ListenerPid
* ranch_listener:remove_connection/1 becomes ranch:remove_connection/1
and its argument is now Ref instead of ListenerPid
Ref is the name of the listener given as first argument to start_listener/6.
Diffstat (limited to 'examples/tcp_echo/src/echo_protocol.erl')
-rw-r--r-- | examples/tcp_echo/src/echo_protocol.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/tcp_echo/src/echo_protocol.erl b/examples/tcp_echo/src/echo_protocol.erl index b54e294..85ea289 100644 --- a/examples/tcp_echo/src/echo_protocol.erl +++ b/examples/tcp_echo/src/echo_protocol.erl @@ -3,12 +3,12 @@ -module(echo_protocol). -export([start_link/4, init/4]). -start_link(ListenerPid, Socket, Transport, Opts) -> - Pid = spawn_link(?MODULE, init, [ListenerPid, Socket, Transport, Opts]), +start_link(Ref, Socket, Transport, Opts) -> + Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts]), {ok, Pid}. -init(ListenerPid, Socket, Transport, _Opts = []) -> - ok = ranch:accept_ack(ListenerPid), +init(Ref, Socket, Transport, _Opts = []) -> + ok = ranch:accept_ack(Ref), loop(Socket, Transport). loop(Socket, Transport) -> |