anchor.diff:      % to the infohash than the closest responsive node.
       NewRetries = if
           (MinQueueDist <  MinAliveDist) -> 0;
  -        (MinQueueDist >= MinAliveDist) -> Retries + 1 end,
  +        (MinQueueDist >= MinAliveDist) -> Retries + 1
  +    end,
   
       % Accumulate the trackers and peers found if this is a get_peers search.
       NewWithPeers = case SearchType of
  
positive.code:     % Check if the closest node in the work queue is closer
      % to the target than the closest responsive node that was
      % found in this iteration.
      {MinAliveDist, _, _, _} = gb_sets:smallest(NewAlive),
      MinQueueDist = case NewNext of
          [] ->
              2 * MinAliveDist;
          Other ->
              {MinDist, _, _, _} = lists:min(Other),
              MinDist
  
negative.code:     return(IP, Port, MsgID, common_values(Self));
  
  handle_query('find_node', Params, IP, Port, MsgID, Self, _Tokens) ->
      Target = etorrent_dht:integer_id(get_value(<<"target">>, Params)),
      CloseNodes = etorrent_dht_state:closest_to(Target),
      BinCompact = node_infos_to_compact(CloseNodes),
      Values = [{<<"nodes">>, BinCompact}],
      return(IP, Port, MsgID, common_values(Self) ++ Values);
  
  handle_query('get_peers', Params, IP, Port, MsgID, Self, Tokens) ->
      InfoHash = etorrent_dht:integer_id(get_value(<<"info_hash">>, Params)),
      Values = case etorrent_dht_tracker:get_peers(InfoHash) of
          [] ->
              Nodes = etorrent_dht_state:closest_to(InfoHash),
              BinCompact = node_infos_to_compact(Nodes),
              [{<<"nodes">>, BinCompact}];
          Peers ->
              PeerList = [peers_to_compact([P]) || P <- Peers],
              [{<<"values">>, PeerList}]
      end,
      Token = [{<<"token">>, token_value(IP, Port, Tokens)}],
      return(IP, Port, MsgID, common_values(Self) ++ Token ++ Values);
  
  handle_query('announce', Params, IP, Port, MsgID, Self, Tokens) ->
      InfoHash = etorrent_dht:integer_id(get_value(<<"info_hash">>, Params)),
      BTPort = get_value(<<"port">>,   Params),
      Token = get_string(<<"token">>, Params),
      _ = case is_valid_token(Token, IP, Port, Tokens) of
          true ->
              etorrent_dht_tracker:announce(InfoHash, IP, BTPort);
          false ->
              FmtArgs = [IP, Port, Token],
              error_logger:error_msg("Invalid token from ~w:~w ~w", FmtArgs)
      end,
      return(IP, Port, MsgID, common_values(Self)).
  
  