Globalize the etorrent_t_peer_group_mgr and rename it to etorrent_choker while here.
[etorrent.git] / lib / etorrent-1.0 / src / etorrent_sup.erl
blobce83e3de6219467b9219d87128bf7ca6232ac4f9
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.
6 %%%
7 %%% Created : 30 Jan 2007 by User Jlouis <jesper.louis.andersen@gmail.com>
8 %%%-------------------------------------------------------------------
9 -module(etorrent_sup).
11 -behaviour(supervisor).
13 %% API
14 -export([start_link/1]).
16 %% Supervisor callbacks
17 -export([init/1]).
19 -define(SERVER, ?MODULE).
21 %%====================================================================
22 %% API functions
23 %%====================================================================
24 start_link(PeerId) ->
25 supervisor:start_link({local, ?MODULE}, ?MODULE, [PeerId]).
27 %%====================================================================
28 %% Supervisor callbacks
29 %%====================================================================
30 init([PeerId]) ->
31 error_logger:info_report([etorrent_supervisor_starting, PeerId]),
32 EventManager = {event_manager,
33 {etorrent_event_mgr, start_link, []},
34 permanent, 2000, worker, [etorrent_event_mgr]},
35 BadPeerMgr = {bad_peer_mgr,
36 {etorrent_bad_peer_mgr, start_link, []},
37 permanent, 5000, worker, [etorrent_bad_peer_mgr]},
38 FastResume = {fast_resume,
39 {etorrent_fast_resume, start_link, []},
40 permanent, 5000, worker, [etorrent_fast_resume]},
41 RateManager = {rate_manager,
42 {etorrent_rate_mgr, start_link, []},
43 permanent, 5000, worker, [etorrent_rate_mgr]},
44 PieceManager = {etorrent_piece_mgr,
45 {etorrent_piece_mgr, start_link, []},
46 permanent, 15000, worker, [etorrent_piece_mgr]},
47 ChunkManager = {etorrent_chunk_mgr,
48 {etorrent_chunk_mgr, start_link, []},
49 permanent, 15000, worker, [etorrent_chunk_mgr]},
50 Choker = {choker,
51 {etorrent_choker, start_link, [PeerId]},
52 permanent, 5000, worker, [etorrent_choker]},
53 Listener = {listener,
54 {etorrent_listener, start_link, []},
55 permanent, 2000, worker, [etorrent_listener]},
56 AcceptorSup = {acceptor_sup,
57 {etorrent_acceptor_sup, start_link, []},
58 permanent, infinity, supervisor, [etorrent_acceptor_sup]},
59 DirWatcherSup = {dirwatcher_sup,
60 {etorrent_dirwatcher_sup, start_link, []},
61 transient, infinity, supervisor, [etorrent_dirwatcher_sup]},
62 TorrentMgr = {manager,
63 {etorrent_t_manager, start_link, [PeerId]},
64 permanent, 2000, worker, [etorrent_t_manager]},
65 TorrentPool = {torrent_pool_sup,
66 {etorrent_t_pool_sup, start_link, []},
67 transient, infinity, supervisor, [etorrent_t_pool_sup]},
69 {ok, {{one_for_all, 1, 60},
70 [EventManager, BadPeerMgr, FastResume, RateManager, PieceManager,
71 ChunkManager, Choker, Listener, AcceptorSup, DirWatcherSup, TorrentMgr,
72 TorrentPool]}}.
74 %%====================================================================
75 %% Internal functions
76 %%====================================================================