anchor.diff:      end.
   
   %% @private
  -started(stop, S) ->
  -    {stop, argh, S};
   started(check_torrent, S) ->
       case check_torrent_for_bad_pieces(S#state.id) of
           [] -> {next_state, started, S};
  
positive.code: started(completed, #state { id = Id, tracker_pid = TrackerPid } = S) ->
      etorrent_event:completed_torrent(Id),
      etorrent_tracker_communication:completed(TrackerPid),
      {next_state, started, S};
  %% @todo kill this
  started({tracker_error_report, Reason}, S) ->
      io:format("Got tracker error: ~s~n", [Reason]),
      {next_state, started, S};
  started({tracker_warning_report, Reason}, S) ->
      io:format("Got tracker warning report: ~s~n", [Reason]),
      {next_state, started, S}.
  
  %% @private
  stopped(start, S) ->
      {stop, argh, S}.
  
  %% @private
  handle_event(Msg, SN, S) ->
  
negative.code: start_link(Id, Path, PeerId) ->
      gen_fsm:start_link(?MODULE, [self(), Id, Path, PeerId], []).
  
  %% @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 Tell the controlled the torrent is complete
  %% @end
  