~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/ssh/src/sshc_sup.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090215164252-q5x4rcf8a5pbesb1
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%<copyright>
 
2
%% <year>2008-2008</year>
 
3
%% <holder>Ericsson AB, All Rights Reserved</holder>
 
4
%%</copyright>
 
5
%%<legalnotice>
 
6
%% The contents of this file are subject to the Erlang Public License,
 
7
%% Version 1.1, (the "License"); you may not use this file except in
 
8
%% compliance with the License. You should have received a copy of the
 
9
%% Erlang Public License along with this software. If not, it can be
 
10
%% retrieved online at http://www.erlang.org/.
 
11
%%
 
12
%% Software distributed under the License is distributed on an "AS IS"
 
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
14
%% the License for the specific language governing rights and limitations
 
15
%% under the License.
 
16
%%
 
17
%% The Initial Developer of the Original Code is Ericsson AB.
 
18
%%</legalnotice>
 
19
%%
 
20
%%----------------------------------------------------------------------
 
21
%% Purpose: The ssh client subsystem supervisor 
 
22
%%----------------------------------------------------------------------
 
23
 
 
24
-module(sshc_sup).
 
25
 
 
26
-behaviour(supervisor).
 
27
 
 
28
-export([start_link/1, start_child/1]).
 
29
 
 
30
%% Supervisor callback
 
31
-export([init/1]).
 
32
 
 
33
%%%=========================================================================
 
34
%%%  API
 
35
%%%=========================================================================
 
36
start_link(Args) ->
 
37
    supervisor:start_link({local, ?MODULE}, ?MODULE, [Args]).
 
38
 
 
39
start_child(Args) ->
 
40
    supervisor:start_child(?MODULE, Args).
 
41
 
 
42
%%%=========================================================================
 
43
%%%  Supervisor callback
 
44
%%%=========================================================================
 
45
init(Args) ->
 
46
    RestartStrategy = simple_one_for_one,
 
47
    MaxR = 10,
 
48
    MaxT = 3600,
 
49
    {ok, {{RestartStrategy, MaxR, MaxT}, [child_spec(Args)]}}.
 
50
 
 
51
%%%=========================================================================
 
52
%%%  Internal functions
 
53
%%%=========================================================================
 
54
child_spec(_) ->
 
55
    Name = undefined, % As simple_one_for_one is used.
 
56
    StartFunc = {ssh_connection_sup, start_link, []},
 
57
    Restart = temporary, 
 
58
    Shutdown = infinity,
 
59
    Modules = [ssh_connection_sup],
 
60
    Type = supervisor,
 
61
    {Name, StartFunc, Restart, Shutdown, Type, Modules}.
 
62