diff options
author | Loïc Hoguin <[email protected]> | 2019-05-09 10:43:25 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-05-09 10:47:15 +0200 |
commit | 3ea575d8682560fc02d5583cbf2837e2f2f43e9f (patch) | |
tree | a20024277c5bad93fd05d9a32013ecabfeddd485 /test/check_tcp_options.erl | |
parent | e92171a8f80755dad795691ad9e07807212d0d1c (diff) | |
download | ranch-3ea575d8682560fc02d5583cbf2837e2f2f43e9f.tar.gz ranch-3ea575d8682560fc02d5583cbf2837e2f2f43e9f.tar.bz2 ranch-3ea575d8682560fc02d5583cbf2837e2f2f43e9f.zip |
Remove Socket argument from ranch_protocol:start_link
Diffstat (limited to 'test/check_tcp_options.erl')
-rw-r--r-- | test/check_tcp_options.erl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/check_tcp_options.erl b/test/check_tcp_options.erl index 18432ac..ecafef7 100644 --- a/test/check_tcp_options.erl +++ b/test/check_tcp_options.erl @@ -1,15 +1,16 @@ -module(check_tcp_options). -behaviour(ranch_protocol). --export([start_link/4]). +-export([start_link/3]). -export([init/3]). -start_link(_, Socket, _, [{pid, TestPid}|TcpOptions]) -> - {ok, RealTcpOptions} = - inet:getopts(Socket, [Key || {Key, _} <- TcpOptions]), - Pid = spawn_link(?MODULE, init, [TestPid, RealTcpOptions, TcpOptions]), +start_link(Ref, _, [{pid, TestPid}|TcpOptions]) -> + Pid = spawn_link(?MODULE, init, [Ref, TestPid, TcpOptions]), {ok, Pid}. -init(Pid, TcpOptions, TcpOptions) -> +init(Ref, Pid, TcpOptions) -> + {ok, Socket} = ranch:handshake(Ref), + {ok, RealTcpOptions} = inet:getopts(Socket, [Key || {Key, _} <- TcpOptions]), + true = TcpOptions =:= RealTcpOptions, Pid ! checked, receive after 2500 -> ok end. |