aboutsummaryrefslogtreecommitdiffstats
path: root/test/remove_conn_and_wait_protocol.erl
blob: 011bd5d90a038f24ad0d4e6256c3b5bdc4bfbeb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-module(remove_conn_and_wait_protocol).

-export([start_link/4]).
-export([init/2]).

start_link(ListenerPid, _, _, [{remove, MaybeRemove}]) ->
	Pid = spawn_link(?MODULE, init, [ListenerPid, MaybeRemove]),
	{ok, Pid}.

init(ListenerPid, MaybeRemove) ->
	ranch:accept_ack(ListenerPid),
	case MaybeRemove of
		true ->
			ranch_listener:remove_connection(ListenerPid);
		false ->
			ok
	end,
	receive after 2500 -> ok end.