1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2014-2020. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20 21%% 22%%---------------------------------------------------------------------- 23%% Purpose: Supervisor for a listen options tracker 24%%---------------------------------------------------------------------- 25-module(tls_server_session_ticket_sup). 26 27-behaviour(supervisor). 28 29%% API 30-export([start_link/0, 31 start_link_dist/0]). 32-export([start_child/1, 33 start_child_dist/1]). 34 35%% Supervisor callback 36-export([init/1, 37 sup_name/1]). 38 39%%%========================================================================= 40%%% API 41%%%========================================================================= 42start_link() -> 43 supervisor:start_link({local, sup_name(normal)}, ?MODULE, []). 44 45start_link_dist() -> 46 supervisor:start_link({local, sup_name(dist)}, ?MODULE, []). 47 48start_child(Args) -> 49 supervisor:start_child(sup_name(normal), Args). 50 51start_child_dist(Args) -> 52 supervisor:start_child(sup_name(dist), Args). 53 54sup_name(normal) -> 55 ?MODULE; 56sup_name(dist) -> 57 list_to_atom(atom_to_list(?MODULE) ++ "_dist"). 58 59%%%========================================================================= 60%%% Supervisor callback 61%%%========================================================================= 62init(_O) -> 63 RestartStrategy = simple_one_for_one, 64 MaxR = 0, 65 MaxT = 3600, 66 67 Name = undefined, % As simple_one_for_one is used. 68 StartFunc = {tls_server_session_ticket, start_link, []}, 69 Restart = temporary, % E.g. should not be restarted 70 Shutdown = 4000, 71 Modules = [tls_server_session_ticket], 72 Type = worker, 73 74 ChildSpec = {Name, StartFunc, Restart, Shutdown, Type, Modules}, 75 {ok, {{RestartStrategy, MaxR, MaxT}, [ChildSpec]}}. 76 77