@Override
	public synchronized void handlePieceAvailability(SharingPeer peer,
			Piece piece) {
		// If we don't have this piece, tell the peer we're interested in
		// getting it from him.
		if (!this.completedPieces.get(piece.getIndex()) &&
			!this.requestedPieces.get(piece.getIndex())) {
			peer.interesting();
		}

		piece.seenAt(peer);
		this.rarest.remove(piece);
		this.rarest.add(piece);

		logger.trace("Peer " + peer + " contributes " +
				peer.getAvailablePieces().cardinality() + " piece(s) [" +
				this.completedPieces.cardinality() + "/" +
				this.getAvailablePieces().cardinality() + "/" +
				this.pieces.length + "].");

		if (!peer.isChoked() &&
			peer.isInteresting() &&
			!peer.isDownloading()) {
			this.handlePeerReady(peer);
		}
	}