diff options
Diffstat (limited to 'test/notify_and_wait_protocol.erl')
-rw-r--r-- | test/notify_and_wait_protocol.erl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/notify_and_wait_protocol.erl b/test/notify_and_wait_protocol.erl index e3e857b..37d0f42 100644 --- a/test/notify_and_wait_protocol.erl +++ b/test/notify_and_wait_protocol.erl @@ -2,12 +2,13 @@ -behaviour(ranch_protocol). -export([start_link/3]). --export([init/2]). +-export([init/3]). -start_link(_, _, [{msg, Msg}, {pid, TestPid}]) -> - Pid = spawn_link(?MODULE, init, [Msg, TestPid]), +start_link(_, _, Opts = #{msg := Msg, pid := TestPid}) -> + Timeout = maps:get(timeout, Opts, 2500), + Pid = spawn_link(?MODULE, init, [Msg, TestPid, Timeout]), {ok, Pid}. -init(Msg, Pid) -> +init(Msg, Pid, Timeout) -> Pid ! Msg, - receive after 2500 -> ok end. + receive after Timeout -> ok end. |