From 5e99ad1f2c5b66b38ed729ceb6a83e8d1c932ac1 Mon Sep 17 00:00:00 2001 From: Jesper Louis Andersen Date: Wed, 30 Jul 2008 20:26:03 +0200 Subject: [PATCH] Un-verbose some names in etorrent_mgr while we are here. --- lib/etorrent-1.0/src/etorrent.erl | 2 +- lib/etorrent-1.0/src/etorrent_dirwatcher.erl | 7 ++----- lib/etorrent-1.0/src/etorrent_mgr.erl | 30 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/lib/etorrent-1.0/src/etorrent.erl b/lib/etorrent-1.0/src/etorrent.erl index 4bdd607..542eaf9 100644 --- a/lib/etorrent-1.0/src/etorrent.erl +++ b/lib/etorrent-1.0/src/etorrent.erl @@ -99,7 +99,7 @@ show(_) -> %% Description: Check a torrents contents. For debugging. %%-------------------------------------------------------------------- check(Id) -> - etorrent_mgr:check_torrent(Id). + etorrent_mgr:check(Id). %%-------------------------------------------------------------------- %% Function: help() -> io() diff --git a/lib/etorrent-1.0/src/etorrent_dirwatcher.erl b/lib/etorrent-1.0/src/etorrent_dirwatcher.erl index 06c5c3c..bcc10da 100644 --- a/lib/etorrent-1.0/src/etorrent_dirwatcher.erl +++ b/lib/etorrent-1.0/src/etorrent_dirwatcher.erl @@ -75,12 +75,9 @@ code_change(_OldVsn, State, _Extra) -> %% Operations watch_directories(S) -> {ok, A, R, N} = scan_files_in_dir(S), - lists:foreach(fun(F) -> - etorrent_mgr:start_torrent(F) - end, + lists:foreach(fun(F) -> etorrent_mgr:start(F) end, sets:to_list(A)), - lists:foreach(fun(F) -> - etorrent_mgr:stop_torrent(F) end, + lists:foreach(fun(F) -> etorrent_mgr:stop(F) end, sets:to_list(R)), N. diff --git a/lib/etorrent-1.0/src/etorrent_mgr.erl b/lib/etorrent-1.0/src/etorrent_mgr.erl index 0fc524a..aac5694 100644 --- a/lib/etorrent-1.0/src/etorrent_mgr.erl +++ b/lib/etorrent-1.0/src/etorrent_mgr.erl @@ -8,10 +8,10 @@ -export([start_link/1, - start_torrent/1, stop_torrent/1, - check_torrent/1, + start/1, stop/1, + check/1, - stop_all_torrents/0]). + stop_all/0]). -export([handle_cast/2, handle_call/3, init/1, terminate/2]). -export([handle_info/2, code_change/3]). @@ -28,25 +28,25 @@ start_link(PeerId) -> gen_server:start_link({local, ?SERVER}, ?MODULE, [PeerId], []). %% Ask the manager process to start a new torrent, given in File. -start_torrent(File) -> - gen_server:cast(?SERVER, {start_torrent, File}). +start(File) -> + gen_server:cast(?SERVER, {start, File}). %% Check a torrents contents -check_torrent(Id) -> - gen_server:cast(?SERVER, {check_torrent, Id}). +check(Id) -> + gen_server:cast(?SERVER, {check, Id}). %% Ask the manager process to stop a torrent, identified by File. -stop_torrent(File) -> - gen_server:cast(?SERVER, {stop_torrent, File}). +stop(File) -> + gen_server:cast(?SERVER, {stop, File}). -stop_all_torrents() -> - gen_server:call(?SERVER, stop_all_torrents, 120000). +stop_all() -> + gen_server:call(?SERVER, stop_all, 120000). %% Callbacks init([PeerId]) -> {ok, #state { local_peer_id = PeerId}}. -handle_cast({start_torrent, F}, S) -> +handle_cast({start, F}, S) -> case torrent_duplicate(F) of true -> {noreply, S}; false -> @@ -57,16 +57,16 @@ handle_cast({start_torrent, F}, S) -> etorrent_counters:next(torrent)), {noreply, S} end; -handle_cast({check_torrent, Id}, S) -> +handle_cast({check, Id}, S) -> {atomic, [T]} = etorrent_tracking_map:select(Id), SPid = T#tracking_map.supervisor_pid, Child = etorrent_t_sup:get_pid(SPid, control), etorrent_t_control:check_torrent(Child), {noreply, S}; -handle_cast({stop_torrent, F}, S) -> +handle_cast({stop, F}, S) -> stop_torrent(F, S). -handle_call(stop_all_torrents, _From, S) -> +handle_call(stop_all, _From, S) -> {atomic, Torrents} = etorrent_tracking_map:all(), lists:foreach(fun(#tracking_map { filename = F }) -> etorrent_t_pool_sup:stop_torrent(F), -- 2.11.4.GIT