GajuDesk/src/gd_net_sup.erl

49 lines
1.1 KiB
Erlang

%%% @doc
%%% GajuDesk : Net Worker Supervisor
%%% @end
-module(gd_net_sup).
-vsn("0.8.0").
-behaviour(supervisor).
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <info@qpq.swiss>").
-license("GPL-3.0-or-later").
-export([start_net/0]).
-export([start_link/0]).
-export([init/1]).
-spec start_net() -> Result
when Result :: {ok, pid()}
| {error, Reason},
Reason :: {already_started, pid()}
| {shutdown, term()}
| term().
start_net() ->
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},
Net =
{gd_net,
{gd_net, start_link, []},
temporary,
brutal_kill,
worker,
[gd_net]},
{ok, {RestartStrategy, [Net]}}.