anchor.diff:      connection_manager:is_interested(State#state.connection_manager_pid,
   				     State#state.peerid),
       State#state{he_interested = true};
  +handle_message({have, PieceNum}, S) ->
  +    NewS = S#state{his_pieces = sets:add_element(PieceNum,
  +						 S#state.his_pieces)},
  +    case torrent_piecemap:peer_got_piece(S#state.piecemap_pid,
  +					 PieceNum) of
  +	interested ->
  +	    RQSize = sets:size(S#state.my_requested),
  +	    if
  +		RQSize =< ?REQUEST_QUEUE_SIZE ->
  +		    attempt_to_queue_pieces(NewS)
  +	    end;
  +	not_interested ->
  +	    NewS
  +    end;
  +handle_message({piece, Index, Begin, Len, Data}, S) ->
  +    filesystem:store_piece(S#state.filesystem_pid, Index, Begin, Len, Data),
  +    case dequeue_request(Index, Begin, Len, S) of
  +	{ok, NS} ->
  +	    attempt_to_queue_pieces(NS);
  +	{error, never_queued} ->
  +	    exit(never_queued) %% May be optimized later on!
  +    end;
   handle_message(not_interested, State) ->
       connection_manager:is_not_interested(State#state.connection_manager_pid,
   					 State#state.peerid),
  
positive.code: 	    no_interesting_piece
      end.
  
  
negative.code: 		piece_table = no,
  	        torrent_id = no}).
  
  %% Default number of pieces to keep queued at other end.
  -define(REQUEST_QUEUE_SIZE, 5).
  
  %%====================================================================
  %% API
  