aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-05-09 10:43:25 +0200
committerLoïc Hoguin <[email protected]>2019-05-09 10:47:15 +0200
commit3ea575d8682560fc02d5583cbf2837e2f2f43e9f (patch)
treea20024277c5bad93fd05d9a32013ecabfeddd485 /test
parente92171a8f80755dad795691ad9e07807212d0d1c (diff)
downloadranch-3ea575d8682560fc02d5583cbf2837e2f2f43e9f.tar.gz
ranch-3ea575d8682560fc02d5583cbf2837e2f2f43e9f.tar.bz2
ranch-3ea575d8682560fc02d5583cbf2837e2f2f43e9f.zip
Remove Socket argument from ranch_protocol:start_link
Diffstat (limited to 'test')
-rw-r--r--test/active_echo_protocol.erl4
-rw-r--r--test/check_tcp_options.erl13
-rw-r--r--test/echo_protocol.erl4
-rw-r--r--test/notify_and_wait_protocol.erl4
-rw-r--r--test/proxy_protocol.erl4
-rw-r--r--test/remove_conn_and_wait_protocol.erl4
-rw-r--r--test/ssl_upgrade_protocol.erl4
-rw-r--r--test/supervisor_separate.erl6
-rw-r--r--test/transport_capabilities_protocol.erl4
-rw-r--r--test/trap_exit_protocol.erl4
10 files changed, 26 insertions, 25 deletions
diff --git a/test/active_echo_protocol.erl b/test/active_echo_protocol.erl
index 37dd6db..3c3ab0d 100644
--- a/test/active_echo_protocol.erl
+++ b/test/active_echo_protocol.erl
@@ -1,10 +1,10 @@
-module(active_echo_protocol).
-behaviour(ranch_protocol).
--export([start_link/4]).
+-export([start_link/3]).
-export([init/3]).
-start_link(Ref, _Socket, Transport, Opts) ->
+start_link(Ref, Transport, Opts) ->
Pid = spawn_link(?MODULE, init, [Ref, Transport, Opts]),
{ok, Pid}.
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.
diff --git a/test/echo_protocol.erl b/test/echo_protocol.erl
index 640f5c6..7bcf15a 100644
--- a/test/echo_protocol.erl
+++ b/test/echo_protocol.erl
@@ -1,10 +1,10 @@
-module(echo_protocol).
-behaviour(ranch_protocol).
--export([start_link/4]).
+-export([start_link/3]).
-export([init/3]).
-start_link(Ref, _Socket, Transport, Opts) ->
+start_link(Ref, Transport, Opts) ->
Pid = spawn_link(?MODULE, init, [Ref, Transport, Opts]),
{ok, Pid}.
diff --git a/test/notify_and_wait_protocol.erl b/test/notify_and_wait_protocol.erl
index f0136a1..e3e857b 100644
--- a/test/notify_and_wait_protocol.erl
+++ b/test/notify_and_wait_protocol.erl
@@ -1,10 +1,10 @@
-module(notify_and_wait_protocol).
-behaviour(ranch_protocol).
--export([start_link/4]).
+-export([start_link/3]).
-export([init/2]).
-start_link(_, _, _, [{msg, Msg}, {pid, TestPid}]) ->
+start_link(_, _, [{msg, Msg}, {pid, TestPid}]) ->
Pid = spawn_link(?MODULE, init, [Msg, TestPid]),
{ok, Pid}.
diff --git a/test/proxy_protocol.erl b/test/proxy_protocol.erl
index 9c679e3..88eb9ff 100644
--- a/test/proxy_protocol.erl
+++ b/test/proxy_protocol.erl
@@ -1,10 +1,10 @@
-module(proxy_protocol).
-behaviour(ranch_protocol).
--export([start_link/4]).
+-export([start_link/3]).
-export([init/3]).
-start_link(Ref, _Socket, Transport, Opts) ->
+start_link(Ref, Transport, Opts) ->
Pid = spawn_link(?MODULE, init, [Ref, Transport, Opts]),
{ok, Pid}.
diff --git a/test/remove_conn_and_wait_protocol.erl b/test/remove_conn_and_wait_protocol.erl
index caac41e..abb4281 100644
--- a/test/remove_conn_and_wait_protocol.erl
+++ b/test/remove_conn_and_wait_protocol.erl
@@ -1,10 +1,10 @@
-module(remove_conn_and_wait_protocol).
-behaviour(ranch_protocol).
--export([start_link/4]).
+-export([start_link/3]).
-export([init/3]).
-start_link(Ref, _, _, [{remove, MaybeRemove, Timeout}]) ->
+start_link(Ref, _, [{remove, MaybeRemove, Timeout}]) ->
Pid = spawn_link(?MODULE, init, [Ref, MaybeRemove, Timeout]),
{ok, Pid}.
diff --git a/test/ssl_upgrade_protocol.erl b/test/ssl_upgrade_protocol.erl
index cafbe13..67aec2b 100644
--- a/test/ssl_upgrade_protocol.erl
+++ b/test/ssl_upgrade_protocol.erl
@@ -1,10 +1,10 @@
-module(ssl_upgrade_protocol).
-behaviour(ranch_protocol).
--export([start_link/4]).
+-export([start_link/3]).
-export([init/3]).
-start_link(Ref, _Socket, Transport, Opts) ->
+start_link(Ref, Transport, Opts) ->
Pid = spawn_link(?MODULE, init, [Ref, Transport, Opts]),
{ok, Pid}.
diff --git a/test/supervisor_separate.erl b/test/supervisor_separate.erl
index 5f1f326..f96c7e4 100644
--- a/test/supervisor_separate.erl
+++ b/test/supervisor_separate.erl
@@ -2,13 +2,13 @@
-behavior(supervisor).
-behavior(ranch_protocol).
--export([start_link/4]).
+-export([start_link/3]).
-export([init/1]).
-start_link(Ref, Socket, Transport, Opts) ->
+start_link(Ref, Transport, Opts) ->
{ok, SupPid} = supervisor:start_link(?MODULE, []),
{ok, ConnPid} = supervisor:start_child(SupPid,
- {echo_protocol, {echo_protocol, start_link, [Ref, Socket, Transport, Opts]},
+ {echo_protocol, {echo_protocol, start_link, [Ref, Transport, Opts]},
temporary, 5000, worker, [echo_protocol]}),
{ok, SupPid, ConnPid}.
diff --git a/test/transport_capabilities_protocol.erl b/test/transport_capabilities_protocol.erl
index ba5024a..5f23d39 100644
--- a/test/transport_capabilities_protocol.erl
+++ b/test/transport_capabilities_protocol.erl
@@ -1,10 +1,10 @@
-module(transport_capabilities_protocol).
-behaviour(ranch_protocol).
--export([start_link/4]).
+-export([start_link/3]).
-export([init/3]).
-start_link(Ref, _Socket, Transport, Opts) ->
+start_link(Ref, Transport, Opts) ->
Pid = spawn_link(?MODULE, init, [Ref, Transport, Opts]),
{ok, Pid}.
diff --git a/test/trap_exit_protocol.erl b/test/trap_exit_protocol.erl
index 6100075..da71fb4 100644
--- a/test/trap_exit_protocol.erl
+++ b/test/trap_exit_protocol.erl
@@ -1,10 +1,10 @@
-module(trap_exit_protocol).
-behaviour(ranch_protocol).
--export([start_link/4]).
+-export([start_link/3]).
-export([init/3]).
-start_link(Ref, _Socket, Transport, Opts) ->
+start_link(Ref, Transport, Opts) ->
Pid = spawn_link(?MODULE, init, [Ref, Transport, Opts]),
{ok, Pid}.