anchor.diff:      error_logger:info_report([got_unknown_message, Msg, S]),
       {stop, {unknown_msg, Msg}}.
   
  -handle_cast(choke, S) ->
  -    perform_choke(S);
  -handle_cast(unchoke, S) when S#state.choke == false ->
  -    {noreply, S, 0};
  +%% Handle requests to choke and unchoke. If we are already choking the peer,
  +%% there is no reason to send the message again.
  +handle_cast(choke, S) -> perform_choke(S);
  +handle_cast(unchoke, S) when S#state.choke == false -> {noreply, S, 0};
   handle_cast(unchoke, S) when S#state.choke == true ->
       ok = etorrent_rate_mgr:local_unchoke(S#state.torrent_id, S#state.parent),
       send_message(unchoke, S#state{choke = false});
  +
  +%% A request to check the current choke state and ask for a rechoking
   handle_cast(check_choke, S) when S#state.choke =:= true ->
       {noreply, S, 0};
   handle_cast(check_choke, S) when S#state.choke =:= false ->
       ok = etorrent_choker:perform_rechoke(),
       {noreply, S, 0};
  +
  +%% Regular messages. We just send them onwards on the wire.
   handle_cast({bitfield, BF}, S) ->
       send_message({bitfield, BF}, S);
   handle_cast(not_interested, S) when S#state.interested =:= false ->
  
positive.code:     send_message(interested, S#state { interested = true });
  handle_cast({have, Pn}, S) ->
      send_message({have, Pn}, S);
  handle_cast({local_request, {Index, Offset, Size}}, S) ->
      send_message({request, Index, Offset, Size}, S);
  handle_cast({remote_request, Idx, Offset, Len}, S)
  
negative.code: unchoke(Pid) ->
      gen_server:cast(Pid, unchoke).
  
  %% This call is used whenever we want to check the choke state of the peer.
  %% If it is true, we perform a rechoke request. It is probably the wrong
  %% place to issue the rechoke request. Rather, it would be better if a
  %% control process does this.
  check_choke(Pid) ->
      gen_server:cast(Pid, check_choke).
  
  %%--------------------------------------------------------------------
  %% Func: not_interested(Pid)
  