diff options
Diffstat (limited to 'test/remove_conn_and_wait_protocol.erl')
-rw-r--r-- | test/remove_conn_and_wait_protocol.erl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/remove_conn_and_wait_protocol.erl b/test/remove_conn_and_wait_protocol.erl new file mode 100644 index 0000000..8fffca7 --- /dev/null +++ b/test/remove_conn_and_wait_protocol.erl @@ -0,0 +1,17 @@ +-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. |