%%%------------------------------------------------------------------- %% @doc efka top level supervisor. %% @end %%%------------------------------------------------------------------- -module(efka_tcp_sup). -behaviour(supervisor). -export([start_link/0, start_child/1]). -export([init/1]). -define(SERVER, ?MODULE). start_link() -> supervisor:start_link({local, ?SERVER}, ?MODULE, []). %% sup_flags() = #{strategy => strategy(), % optional %% intensity => non_neg_integer(), % optional %% period => pos_integer()} % optional %% child_spec() = #{id => child_id(), % mandatory %% start => mfargs(), % mandatory %% restart => restart(), % optional %% shutdown => shutdown(), % optional %% type => worker(), % optional %% modules => modules()} % optional init([]) -> SupFlags = #{strategy => simple_one_for_one, intensity => 0, period => 1}, ChildSpec = #{ id => tcp_channel, start => {tcp_channel, start_link, []}, restart => temporary, type => worker }, {ok, {SupFlags, [ChildSpec]}}. %% internal functions start_child(Socket) -> supervisor:start_child(?MODULE, [Socket]).