void ChunkManager::Private::doPreviewPriority(TorrentFile & file)
	{
		if (file.getPriority() == EXCLUDED || file.getPriority() == ONLY_SEED_PRIORITY)
			return;
		
		if (file.getFirstChunk() == file.getLastChunk())
		{
			// prioritise whole file 
			p->prioritise(file.getFirstChunk(),file.getLastChunk(),PREVIEW_PRIORITY);
			return;
		}
		
		Uint32 nchunks = p->previewChunkRangeSize(file);
		if (!nchunks)
			return;
		
		p->prioritise(file.getFirstChunk(), file.getFirstChunk()+nchunks, PREVIEW_PRIORITY);
		if (file.getLastChunk() - file.getFirstChunk() > nchunks)
		{
			p->prioritise(file.getLastChunk() - nchunks, file.getLastChunk(), PREVIEW_PRIORITY);
		}	
	}
Esempio n. 2
0
	TorrentFile::TorrentFile(const TorrentFile & tf)
		: TorrentFileInterface(tf.getIndex(),QString(),0)
	{
		setUnencodedPath(tf.unencoded_path); 
		index = tf.getIndex();
		path = tf.getPath();
		size = tf.getSize();
		cache_offset = tf.getCacheOffset();
		first_chunk = tf.getFirstChunk();
		first_chunk_off = tf.getFirstChunkOffset();
		last_chunk = tf.getLastChunk();
		last_chunk_size = tf.getLastChunkSize();
		old_priority = priority = tf.getPriority();
		missing = tf.isMissing();
		tor = tf.tor;
		filetype = UNKNOWN;
	}