anchor.diff: -%%%-------------------------------------------------------------------
  -%%% File    : etorrent_choker.erl
  -%%% Author  : Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
  -%%% License : See COPYING
  -%%% Description : Master process for a number of peers.
  -%%%
  -%%% Created : 18 Jul 2007 by
  -%%%      Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
  -%%%-------------------------------------------------------------------
  +%% @author Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
  +%% @doc Choose which peers to download from / upload to.
  +%% <p>The choking module is responsible for performing choking
  +%% operations every 10 seconds. It queries the current state of all
  +%% peers and subsequently chokes/unchokes peers according to the
  +%% choking algorithm.</p>
  +%% <p>The choking algorithm is probably the nastiest part of the
  +%% BitTorrent protocol. Several things are taken into consideration,
  +%% including download speed, upload speed, interest and if the peer is
  +%% choking us or not.</p>
  +%% @end
   -module(etorrent_choker).
   
   -behaviour(gen_server).
  
positive.code: -ignore_xref([{start_link, 1}]).
  
  %%====================================================================
  %% API
  %%====================================================================
  -spec start_link(pid()) -> {ok, pid()} | {error, any()} | ignore.
  start_link(OurPeerId) ->
      gen_server:start_link({local, ?SERVER}, ?MODULE, [OurPeerId], []).
  
  -spec perform_rechoke() -> ok.
  perform_rechoke() ->
      gen_server:cast(?SERVER, rechoke).
  
  -spec monitor(pid()) -> ok.
  monitor(Pid) ->
      gen_server:call(?SERVER, {monitor, Pid}).
  
negative.code:     ?ERR([unknown_peer_group_call, Request]),
      Reply = ok,
      {reply, Reply, State}.
  
  %% @private
  handle_cast(rechoke, #state { opt_unchoke_chain = Chain } = S) ->
      rechoke(Chain),
      {noreply, S};
  handle_cast(_Msg, State) ->
      {noreply, State}.
  
  %% @private
  handle_info(round_tick, S) ->
      R = case S#state.round of
          0 ->
  