Updated get_next_request to deal with last block and last piece.