-
Notifications
You must be signed in to change notification settings - Fork 0
/
udp_listener_sup.erl
37 lines (31 loc) · 1.23 KB
/
udp_listener_sup.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-module(udp_listener_sup).
-behaviour(supervisor).
-mode(compile).
-compile(export_all).
-include("../logger.hrl").
%%====================================================================
%% API functions
%%====================================================================
start_link(#{}=State) ->
(supervisor:start_link({local, ?MODULE}, ?MODULE, State)).
start_child(#{socket := Socket}=State) ->
(supervisor:start_child(?MODULE, [State])).
terminate_child(PID) ->
(supervisor:terminate_child(?MODULE, PID)).
%%====================================================================
%% Behaviour callbacks
%%====================================================================
init(#{}=State) ->
Children = [
#{id => udp_listener,
start => {udp_listener, start_link, [State]},
restart => temporary,
shutdown => 100,
type => worker,
modules => [udp_listener]
}
],
({ok, {{simple_one_for_one, 0, 1}, Children}}).
%%====================================================================
%% Internal functions
%%====================================================================