aboutsummaryrefslogtreecommitdiffstats
path: root/test/supervisor_separate.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-08-20 14:28:16 +0200
committerLoïc Hoguin <[email protected]>2015-08-20 14:28:16 +0200
commitc867ec582d445b251ff659ba23f522b5278d5119 (patch)
tree50efcb176bc97207ed06a536acd2f7c56db9db98 /test/supervisor_separate.erl
parent32e4ebef2ce16b2b1fce2a4af7bb2bd7ef17f235 (diff)
downloadranch-c867ec582d445b251ff659ba23f522b5278d5119.tar.gz
ranch-c867ec582d445b251ff659ba23f522b5278d5119.tar.bz2
ranch-c867ec582d445b251ff659ba23f522b5278d5119.zip
Add tests and more docs about separate supervisor/connection
Diffstat (limited to 'test/supervisor_separate.erl')
-rw-r--r--test/supervisor_separate.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/supervisor_separate.erl b/test/supervisor_separate.erl
new file mode 100644
index 0000000..5f1f326
--- /dev/null
+++ b/test/supervisor_separate.erl
@@ -0,0 +1,16 @@
+-module(supervisor_separate).
+-behavior(supervisor).
+-behavior(ranch_protocol).
+
+-export([start_link/4]).
+-export([init/1]).
+
+start_link(Ref, Socket, Transport, Opts) ->
+ {ok, SupPid} = supervisor:start_link(?MODULE, []),
+ {ok, ConnPid} = supervisor:start_child(SupPid,
+ {echo_protocol, {echo_protocol, start_link, [Ref, Socket, Transport, Opts]},
+ temporary, 5000, worker, [echo_protocol]}),
+ {ok, SupPid, ConnPid}.
+
+init([]) ->
+ {ok, {{one_for_one, 1, 1}, []}}.