anchor.diff:  
   code_change(_, State, _) ->
       {ok, State}.
  +
  +-ifdef(TEST).
  +-include_lib("eunit/include/eunit.hrl").
  +-define(endgame, ?MODULE).
  +-define(pending, etorrent_pending).
  +-define(chunkstate, etorrent_chunkstate).
  +
  +testid() -> 0.
  +testpid() -> ?endgame:lookup_server(testid()).
  +
  +setup() ->
  +    {ok, PPid} = ?pending:start_link(testid()),
  +    {ok, EPid} = ?endgame:start_link(testid()),
  +    {PPid, EPid}.
  +
  +teardown({PPid, EPid}) ->
  +    ok = etorrent_utils:shutdown(EPid),
  +    ok = etorrent_utils:shutdown(PPid).
  +
  +
  +
  +endgame_test_() ->
  +    {setup, local,
  +        fun() -> application:start(gproc) end,
  +        fun(_) -> application:stop(gproc) end,
  +    {foreach, local,
  +        fun setup/0,
  +        fun teardown/1, [
  +    ?_test(test_registers()),
  +    ?_test(test_starts_inactive()),
  +    ?_test(test_activated())
  +    ]}}.
  +
  +test_registers() ->
  +    ?assert(is_pid(?endgame:lookup_server(testid()))),
  +    ?assert(is_pid(?endgame:await_server(testid()))).
  +
  +test_starts_inactive() ->
  +    ?assertNot(?endgame:is_active(testpid())).
  +
  +test_activated() ->
  +    ?assertEqual(ok, ?endgame:activate(testpid())),
  +    ?assert(?endgame:is_active(testpid())).
  +
  +
  +
  +-endif.
  
positive.code: handle_call(is_active, _, State) ->
      #state{active=IsActive} = State,
      {reply, IsActive, State};
  
  handle_call({request_chunks, Pid, Peerset, _}, _, State) ->
      #state{pending=Pending, requests=Requests} = State,
  
negative.code: start_link(TorrentID) ->
      gen_server:start_link(?MODULE, [TorrentID], []).
  
  
  %% @doc
  %% @end
  -spec is_active(pid()) -> boolean().
  is_active(SrvPid) ->
      gen_server:call(SrvPid, is_active).
  
  
  %% @doc
  %% @end
  -spec activate(pid()) -> ok.
  activate(SrvPid) ->
      gen_server:call(SrvPid, activate).
  
  
  %% @private
  init([TorrentID]) ->
      true = register_server(TorrentID),
      Pending = etorrent_pending:await_server(TorrentID),
      InitState = #state{
          active=false,
          pending=Pending,
  