1 %%%-------------------------------------------------------------------
2 %%% File : etorrent.erl
3 %%% Author : User Jlouis <jesper.louis.andersen@gmail.com>
4 %%% License : See COPYING
5 %%% Description : Start up etorrent and supervise it.
7 %%% Created : 30 Jan 2007 by User Jlouis <jesper.louis.andersen@gmail.com>
8 %%%-------------------------------------------------------------------
11 -behaviour(supervisor
).
14 -export([start_link
/0]).
16 %% Supervisor callbacks
19 -define(SERVER
, ?MODULE
).
21 %%====================================================================
23 %%====================================================================
25 supervisor:start_link({local
, ?MODULE
}, ?MODULE
, []).
27 %%====================================================================
28 %% Supervisor callbacks
29 %%====================================================================
31 EventManager
= {event_manager
,
32 {etorrent_event_mgr
, start_link
, []},
33 permanent
, 2000, worker
, [etorrent_event_mgr
]},
34 BadPeerMgr
= {bad_peer_mgr
,
35 {etorrent_bad_peer_mgr
, start_link
, []},
36 permanent
, 5000, worker
, [etorrent_bad_peer_mgr
]},
37 FastResume
= {fast_resume
,
38 {etorrent_fast_resume
, start_link
, []},
39 permanent
, 5000, worker
, [etorrent_fast_resume
]},
40 RateManager
= {rate_manager
,
41 {etorrent_rate_mgr
, start_link
, []},
42 permanent
, 5000, worker
, [etorrent_rate_mgr
]},
43 PieceManager
= {etorrent_piece_mgr
,
44 {etorrent_piece_mgr
, start_link
, []},
45 permanent
, 15000, worker
, [etorrent_piece_mgr
]},
46 ChunkManager
= {etorrent_chunk_mgr
,
47 {etorrent_chunk_mgr
, start_link
, []},
48 permanent
, 15000, worker
, [etorrent_chunk_mgr
]},
50 {etorrent_listener
, start_link
, []},
51 permanent
, 2000, worker
, [etorrent_listener
]},
52 AcceptorSup
= {acceptor_sup
,
53 {etorrent_acceptor_sup
, start_link
, []},
54 permanent
, infinity
, supervisor
, [etorrent_acceptor_sup
]},
55 DirWatcherSup
= {dirwatcher_sup
,
56 {etorrent_dirwatcher_sup
, start_link
, []},
57 transient
, infinity
, supervisor
, [etorrent_dirwatcher_sup
]},
58 TorrentMgr
= {manager
,
59 {etorrent_t_manager
, start_link
, []},
60 permanent
, 2000, worker
, [etorrent_t_manager
]},
61 TorrentPool
= {torrent_pool_sup
,
62 {etorrent_t_pool_sup
, start_link
, []},
63 transient
, infinity
, supervisor
, [etorrent_t_pool_sup
]},
65 {ok
, {{one_for_all
, 1, 60},
66 [EventManager
, BadPeerMgr
, FastResume
, PieceManager
,
67 ChunkManager
, RateManager
, Listener
, AcceptorSup
, DirWatcherSup
, TorrentMgr
,
70 %%====================================================================
72 %%====================================================================