anchor.diff:  handle_call(is_active, _, State) ->
       #state{active=IsActive} = State,
       {reply, IsActive, State};
  +
  +handle_call(activate, _, State) ->
  +    #state{active=false} = State,
  +    NewState = State#state{active=true},
  +    {reply, ok, NewState};
   
   handle_call({request_chunks, Pid, Peerset, _}, _, State) ->
       #state{pending=Pending, requests=Requests} = State,
  
positive.code: 
  -record(state, {
      active   :: boolean(),
      pending  :: etorrent_pending:originhandle(),
      requests :: gb_tree()}).
  
  -opaque peerhandle() :: {peer, pid()}.
  -opaque originhandle() :: {origin, pid()}.
  -export_type([peerhandle/0, originhandle/0]).
  
  
  server_name(TorrentID) ->
  
negative.code: 
  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.
  