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
/1]).
16 %% Supervisor callbacks
19 -define(SERVER
, ?MODULE
).
21 %%====================================================================
23 %%====================================================================
25 supervisor:start_link({local
, ?MODULE
}, ?MODULE
, [PeerId
]).
27 %%====================================================================
28 %% Supervisor callbacks
29 %%====================================================================
31 error_logger:info_report([etorrent_supervisor_starting
, PeerId
]),
33 {etorrent_counters
, start_link
, []},
34 permanent
, 2000, worker
, [etorrent_counters
]},
35 EventManager
= {event_manager
,
36 {etorrent_event_mgr
, start_link
, []},
37 permanent
, 2000, worker
, [etorrent_event_mgr
]},
39 {etorrent_peer_mgr
, start_link
, [PeerId
]},
40 permanent
, 5000, worker
, [etorrent_peer_mgr
]},
41 FastResume
= {fast_resume
,
42 {etorrent_fast_resume
, start_link
, []},
43 permanent
, 5000, worker
, [etorrent_fast_resume
]},
44 RateManager
= {rate_manager
,
45 {etorrent_rate_mgr
, start_link
, []},
46 permanent
, 5000, worker
, [etorrent_rate_mgr
]},
47 PieceManager
= {etorrent_piece_mgr
,
48 {etorrent_piece_mgr
, start_link
, []},
49 permanent
, 15000, worker
, [etorrent_piece_mgr
]},
50 ChunkManager
= {etorrent_chunk_mgr
,
51 {etorrent_chunk_mgr
, start_link
, []},
52 permanent
, 15000, worker
, [etorrent_chunk_mgr
]},
54 {etorrent_choker
, start_link
, [PeerId
]},
55 permanent
, 5000, worker
, [etorrent_choker
]},
57 {etorrent_listener
, start_link
, []},
58 permanent
, 2000, worker
, [etorrent_listener
]},
59 AcceptorSup
= {acceptor_sup
,
60 {etorrent_acceptor_sup
, start_link
, [PeerId
]},
61 permanent
, infinity
, supervisor
, [etorrent_acceptor_sup
]},
62 TorrentMgr
= {manager
,
63 {etorrent_mgr
, start_link
, [PeerId
]},
64 permanent
, 2000, worker
, [etorrent_mgr
]},
65 DirWatcherSup
= {dirwatcher_sup
,
66 {etorrent_dirwatcher_sup
, start_link
, []},
67 transient
, infinity
, supervisor
, [etorrent_dirwatcher_sup
]},
68 TorrentPool
= {torrent_pool_sup
,
69 {etorrent_t_pool_sup
, start_link
, []},
70 transient
, infinity
, supervisor
, [etorrent_t_pool_sup
]},
72 {ok
, {{one_for_all
, 1, 60},
73 [Counters
, EventManager
, PeerMgr
, FastResume
, RateManager
, PieceManager
,
74 ChunkManager
, Choker
, Listener
, AcceptorSup
, TorrentMgr
, DirWatcherSup
,
77 %%====================================================================
79 %%====================================================================