Integrating Piece and Peer Selection in Content Distribution Networks