anchor.diff: -%%% A manager for UDP communication with trackers
  +%% @author Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
  +%% @doc Handle the UDP tracker protocol.
  +%% <p>This module is a central module to UDP tracker requests (BEP-15
  +%% support). It provides an interface that torrents can use to query
  +%% the UDP tracker with. The call is currently blocking, so the other
  +%% process is not going to do anything while waiting for a
  +%% response. The default timeout-i-give-up-time is 60 seconds.</p>
  +%% <p>Apart from serving as the main entry point, this module also
  +%% implements a Manager gen_server which is used to manage the current
  +%% outstanding requests, their types and which processes are
  +%% responsible for the different requests. Data is ETS-stored and
  +%% monitors are used to clean up.</p>
  +%% <p>The granularity is one process per request-event. The
  +%% event-processes are defined in the module etorrent_udp_tracker. It
  +%% is easier to handle timeout and such in a separate process rather
  +%% than keep centrally track of it.</p>
  +%% @end
   -module(etorrent_udp_tracker_mgr).
   
   -behaviour(gen_server).
  
positive.code: 	    {ok, Pid}
      end.
  
  reg_connid_gather(Tracker) ->
      ets:insert(?TAB, [{{conn_id_req, Tracker}, self()},
  		      {self(), {conn_id_req, Tracker}}]).
  
  reg_tr_id(Tid) ->
      true = ets:insert(?TAB, [{Tid, self()}, {self(), Tid}]).
  
  unreg_tr_id(Tid) ->
      [true] = delete_object(?TAB, [{Tid, self()}, {self(), Tid}]).
  
  reg_announce(Tracker, PL) ->
      true = ets:insert(?TAB, [{{announce, Tracker}, self()},
  			     {{Tracker, PL}, self()},
  			     {self(), {Tracker, PL}}]).
  
  reg_connid(Tracker, ConnID) ->
      ets:insert(?TAB, [{{conn_id, Tracker}, ConnID}]).
  
  msg(Tr, M) ->
      gen_server:cast(?MODULE, {msg, Tr, M}).
  
  %%====================================================================
  init([]) ->
      ets:new(?TAB, [named_table, public, {keypos, 1}, bag]),
      {ok, Port} = application:get_env(etorrent, udp_port),
      {ok, Socket} = gen_udp:open(Port, [binary, {active, true}, inet, inet6]),
      {ok, #state{ socket = Socket }}.
  
  handle_call({announce, Tracker, PL}, From, S) ->
      case ets:lookup(?TAB, {conn_id, Tracker}) of
  	[] ->
  
negative.code:     ?WARN([unknown_msg, Msg]),
      {noreply, State}.
  
  %% @private
  handle_info({udp, _, _IP, _Port, Packet}, S) ->
      etorrent_udp_tracker_proto:decode_dispatch(Packet),
      {noreply, S};
  