anchor.diff:  
   tval(Client, TimeoutRef) ->
       {Client, TimeoutRef}.
  +
  +%
  +% Generate a random token value. A token value is used to filter out bogus announce
  +% requests, or at least announce requests from nodes that never sends get_peers requests.
  +%
  +random_token() ->
  +    ID0 = random:uniform(16#FFFF),
  +    ID1 = random:uniform(16#FFFF),
  +    <<ID0:16, ID1:16>>.
  +
  +%
  +% Initialize the socket server's token queue, the size of this queue
  +% will be kept constant during the running-time of the server. The
  +% size of this queue specifies how old tokens the server will accept.
  +%
  +init_tokens(NumTokens) ->
  +    queue:from_list([random_token() || _ <- lists:seq(1, NumTokens)]).
  +%
  +% Calculate the token value for a client based on the % client's IP address
  +% and Port number combined with a secret token value held by the socket server.
  +% This avoids the need to store unique token values in the socket server.
  +%
  +token_value(IP, Port, Token) when is_binary(Token) ->
  +    Hash = erlang:phash2({IP, Port, Token}),
  +    <<Hash:32>>;
  +
  +token_value(IP, Port, Tokens) ->
  +    MostRecent = queue:last(Tokens),
  +    token_value(IP, Port, MostRecent).
  +
  +
  +
  +%
  +% Check if a token value included by a node in an announce message is bogus
  +% of based on a token that is not recent enough.
  +%
  +is_valid_token(TokenValue, IP, Port, Tokens) ->
  +    ValidValues = [token_value(IP, Port, Token) || Token <- queue:to_list(Tokens)],
  +    lists:member(TokenValue, ValidValues).
  +
  +%
  +% Discard the oldest token and create a new one to replace it.
  +%
  +renew_token(Tokens) ->
  +    {_, WithoutOldest} = queue:out(Tokens),
  +    queue:in(random_token(), WithoutOldest).
  +
  +
   
   decode_msg(InMsg) ->
       Msg = etorrent_bcoding:decode(InMsg),
  
positive.code: common_values(Self) ->
      [{{string, "id"}, {string, binary_to_list(Self)}}].
  
  handle_query('ping', _, IP, Port, MsgID, Self) ->
      return(IP, Port, MsgID, common_values(Self));
  
  handle_query('find_node', Params, IP, Port, MsgID, Self) ->
      {string, LTarget} = search_dict({string, "target"}, Params),
      Target = list_to_binary(LTarget),
      CloseNodes = [{ID, NIP, NPort} || {_, ID, NIP, NPort} <- etorrent_dht_state:closest_to(Target)],
  
negative.code:     end,
      {noreply, NewState};
  
  handle_info(renew_token, State) ->
      #state{tokens=PrevTokens} = State,
      NewTokens = renew_token(PrevTokens),
      NewState = State#state{tokens=NewTokens},
      erlang:send_after(token_lifetime(), self(), renew_token),
      {noreply, NewState};
  
  handle_info({udp, _Socket, IP, Port, Packet}, State) ->
      #state{
          sent=Sent,
          tokens=Tokens} = State,
      Self = etorrent_dht_state:node_id(),
      NewState = case (catch decode_msg(Packet)) of
          {'EXIT', _} ->
  