anchor.diff:                                peer_id = PeerId,
                                 parent_pid = Parent}, 0}. % Force timeout instantly.
   
  +%% @private
  +%% @todo Split and simplify this monster function
   initializing(timeout, S) ->
       case etorrent_table:acquire_check_token(S#state.id) of
           false ->
  
positive.code:     etorrent_event_mgr:completed_torrent(Id),
      etorrent_tracker_communication:completed(TrackerPid),
      {next_state, started, S};
  started({tracker_error_report, Reason}, S) ->
      io:format("Got tracker error: ~s~n", [Reason]),
      {next_state, started, S}.
  
  stopped(start, S) ->
      {stop, argh, S}.
  
  handle_event(Msg, SN, S) ->
      io:format("Problem: ~p~n", [Msg]),
      {next_state, SN, S}.
  
  handle_sync_event(_Event, _From, StateName, State) ->
      Reply = ok,
      {reply, Reply, StateName, State}.
  
  handle_info(Info, StateName, State) ->
      ?WARN([unknown_info, Info, StateName]),
      {next_state, StateName, State}.
  
  terminate(_Reason, _StateName, _S) ->
      ok.
  
  code_change(_OldVsn, StateName, State, _Extra) ->
      {ok, StateName, State}.
  
  %% --------------------------------------------------------------------
  calculate_amount_left(Id) when is_integer(Id) ->
      Pieces = etorrent_piece_mgr:select(Id),
      lists:sum([etorrent_piece_mgr:size_piece(P) || P <- Pieces]).
  
  
  
  
negative.code: -define(CHECK_WAIT_TIME, 3000).
  
  %% ====================================================================
  
  %% @doc Start the server process
  -spec start_link(integer(), string(), binary()) ->
          {ok, pid()} | ignore | {error, term()}.
  start_link(Id, Path, PeerId) ->
      gen_fsm:start_link(?MODULE, [self(), Id, Path, PeerId], []).
  
  %% @doc Request that the given torrent is stopped
  %% @end
  -spec stop(pid()) -> ok.
  stop(Pid) ->
      gen_fsm:send_event(Pid, stop).
  
  %% @doc Request that the given torrent is started
  %% @end
  -spec start(pid()) -> ok.
  start(Pid) ->
      gen_fsm:send_event(Pid, start).
  
  %% @doc Request that the given torrent is checked (eventually again)
  %% @end
  -spec check_torrent(pid()) -> ok.
  check_torrent(Pid) ->
      gen_fsm:send_event(Pid, check_torrent).
  
  %% @doc Report an error from the tracker
  %% @end
  -spec tracker_error_report(pid(), term()) -> ok.
  tracker_error_report(Pid, Report) ->
      gen_fsm:send_event(Pid, {tracker_error_report, Report}).
  
  %% @doc Report a warning from the tracker
  %% @end
  -spec tracker_warning_report(pid(), term()) -> ok.
  tracker_warning_report(Pid, Report) ->
      gen_fsm:send_event(Pid, {tracker_warning_report, Report}).
  
  %% @doc Tell the controlled the torrent is complete
  %% @end
  -spec completed(pid()) -> ok.
  completed(Pid) ->
      gen_fsm:send_event(Pid, completed).
  
  %% ====================================================================
  
  %% @private
  init([Parent, Id, Path, PeerId]) ->
      etorrent_table:new_torrent(Path, Parent, Id),
      etorrent_chunk_mgr:new(Id),
  