1 |
|
%% @doc Supervisor for the socket listeners |
2 |
|
|
3 |
|
-module(mongoose_listener_sup). |
4 |
|
|
5 |
|
-behaviour(supervisor). |
6 |
|
|
7 |
|
-export([start_link/0, start_child/1, init/1]). |
8 |
|
|
9 |
|
-ignore_xref([start_link/0, init/1]). |
10 |
|
|
11 |
|
-include("mongoose_logger.hrl"). |
12 |
|
|
13 |
|
%% API |
14 |
|
|
15 |
|
-spec start_link() -> {ok, pid()}. |
16 |
|
start_link() -> |
17 |
93 |
supervisor:start_link({local, ?MODULE}, ?MODULE, []). |
18 |
|
|
19 |
|
-spec start_child(supervisor:child_spec()) -> ok. |
20 |
|
start_child(ChildSpec) -> |
21 |
|
%% Use ejabberd_sup function for extra logging on errors |
22 |
1159 |
ejabberd_sup:start_child(?MODULE, ChildSpec), |
23 |
1159 |
ok. |
24 |
|
|
25 |
|
%% Supervisor callbacks |
26 |
|
|
27 |
|
-spec init([]) -> {ok, {supervisor:sup_flags(), []}}. |
28 |
|
init([]) -> |
29 |
93 |
{ok, {#{strategy => one_for_one, |
30 |
|
intensity => 10, |
31 |
|
period => 1}, []}}. |