anchor.diff:  
   handle_call({chunk, {request, _, Peerset, Pid}}, _, State) ->
       #state{pending=Pending, requests=Requests} = State,
  -    Request = etorrent_util:find(
  +    Request = etorrent_utils:find(
           fun({{Index, _, _}, Peers}) ->
  -            etorrent_pieceset:is_member(Index, Peerset)
  -            and not lists:member(Pid, Peers)
  +            (etorrent_pieceset:is_member(Index, Peerset))
  +            andalso (not lists:member(Pid, Peers))
           end, gb_trees:to_list(Requests)),
       case Request of
           false ->
               {reply, {ok, assigned}, State};
           {{Index, Offset, Length}=Chunk, Peers} ->
  -            etorrent_pending:mark_sent(Index, Offset, Length, Pid, Pending),
  +            etorrent_chunkstate:assigned(Index, Offset, Length, Pid, Pending),
               NewRequests = gb_trees:update(Chunk, [Pid|Peers], Requests),
               NewState = State#state{requests=NewRequests},
               {reply, {ok, [Chunk]}, NewState}
  
positive.code:     ?assertEqual(ok, ?endgame:activate(testpid())),
      ?assert(?endgame:is_active(testpid())).
  
  
  
  -endif.
  
negative.code: 
  
  %% @private
  handle_info({chunk, {assigned, Index, Offset, Length, Pid}}, State) ->
      %% Load a request that was assigned by etorrent_progress
      #state{active=true, requests=Requests} = State,
      Chunk = {Index, Offset, Length},
      NewRequests = gb_trees:insert(Chunk, [Pid], Requests),
      NewState = State#state{requests=NewRequests},
      {noreply, NewState};
  
  handle_info({chunk, {dropped, Index, Offset, Length, Pid}}, State) ->
      #state{active=true, requests=Requests, fetched=Fetched} = State,
      Chunk = {Index, Offset, Length},
      {WasFetcher, NewFetched} = case gb_trees:lookup(Chunk, Fetched) of
          none -> {false, Fetched};
          {value, Pid} -> {true, gb_trees:delete(Chunk, Fetched)}
      end,
      NewRequests = case gb_trees:lookup(Chunk, Requests) of
          none when WasFetcher -> gb_trees:insert(Chunk, [], Requests);
          none -> Requests;
          {value, Peers} -> gb_trees:update(Chunk, Peers -- [Pid], Requests)
      end,
      NewState = State#state{requests=NewRequests, fetched=NewFetched},
      {noreply, NewState};
  
  handle_info({chunk, {fetched, Index, Offset, Length, Pid}}, State) ->
      #state{active=true, requests=Requests, fetched=Fetched} = State,
      Chunk = {Index, Offset, Length},
      {NewFetched, NewRequests} = case gb_trees:lookup(Chunk, Requests) of
          none -> {Fetched, Requests};
          {value, Peers} ->
              [etorrent_peer_control:cancel(Peer, Index, Offset, Length) || Peer <- Peers],
              IFetched = gb_trees:insert(Chunk, Pid, Fetched),
              IRequests = gb_trees:delete(Chunk, Requests),
              {IFetched, IRequests}
      end,
      NewState = State#state{requests=NewRequests, fetched=NewFetched},
      {noreply, NewState};
  
  handle_info({chunk, {stored, Index, Offset, Length, Pid}}, State) ->
      #state{active=true, requests=Requests} = State,
      NewState = State#state{},
      {noreply, NewState}.
  
  terminate(_, State) ->
      {ok, State}.
  