actually add msp_channel_sup.erl
oops
This commit is contained in:
parent
0ccd64e2f1
commit
669b2e51e1
48
src/msp_channel_sup.erl
Normal file
48
src/msp_channel_sup.erl
Normal file
@ -0,0 +1,48 @@
|
||||
%%% @doc
|
||||
%%% Minimal Stream Protocol : Channel Worker Supervisor
|
||||
%%% @end
|
||||
|
||||
-module(msp_channel_sup).
|
||||
-vsn("0.1.0").
|
||||
-behaviour(supervisor).
|
||||
-author("Jarvis Carroll <spiveehere@gmail.com>").
|
||||
-copyright("Jarvis Carroll <spiveehere@gmail.com>").
|
||||
-license("MIT").
|
||||
|
||||
|
||||
-export([start_channel/0]).
|
||||
-export([start_link/0]).
|
||||
-export([init/1]).
|
||||
|
||||
|
||||
-spec start_channel() -> Result
|
||||
when Result :: {ok, pid()}
|
||||
| {error, Reason},
|
||||
Reason :: {already_started, pid()}
|
||||
| {shutdown, term()}
|
||||
| term().
|
||||
|
||||
start_channel() ->
|
||||
supervisor:start_child(?MODULE, []).
|
||||
|
||||
|
||||
-spec start_link() -> {ok, pid()}.
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link({local, ?MODULE}, ?MODULE, none).
|
||||
|
||||
|
||||
-spec init(none) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}}.
|
||||
%% @private
|
||||
%% The OTP init/1 function.
|
||||
|
||||
init(none) ->
|
||||
RestartStrategy = {simple_one_for_one, 1, 60},
|
||||
Channel =
|
||||
{msp_channel,
|
||||
{msp_channel, start_link, []},
|
||||
temporary,
|
||||
brutal_kill,
|
||||
worker,
|
||||
[msp_channel]},
|
||||
{ok, {RestartStrategy, [Channel]}}.
|
||||
Loading…
x
Reference in New Issue
Block a user