本文整理汇总了C++中Downloader::downloading方法的典型用法代码示例。如果您正苦于以下问题:C++ Downloader::downloading方法的具体用法?C++ Downloader::downloading怎么用?C++ Downloader::downloading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Downloader
的用法示例。
在下文中一共展示了Downloader::downloading方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testCriticalChunkSpread
void testCriticalChunkSpread()
{
DummyTorrentCreator creator;
bt::TorrentControl tc;
QVERIFY(creator.createSingleFileTorrent(2*TEST_FILE_SIZE,"test2.avi"));
Out(SYS_GEN|LOG_DEBUG) << "Created " << creator.torrentPath() << endl;
try
{
tc.init(0,creator.torrentPath(),creator.tempPath() + "tor0",creator.tempPath() + "data/");
tc.createFiles();
}
catch (bt::Error & err)
{
Out(SYS_GEN|LOG_DEBUG) << "Failed to load torrent: " << creator.torrentPath() << endl;
QFAIL("Torrent load failure");
}
ExtendedStreamingChunkSelector* csel = new ExtendedStreamingChunkSelector();
tc.setChunkSelector(csel);
QVERIFY(csel != 0);
Downloader* downer = csel->downloader();
QVERIFY(downer != 0);
// Check that critical chunks are spread over multiple peers
csel->setSequentialRange(20,60);
DummyDownloader dd[32];
for (Uint32 i = 0;i < 32;i++)
{
downer->addPieceDownloader(&dd[i]);
}
// Check the spread of the downloaders
downer->update();
for (Uint32 i = 20;i < csel->criticialWindowSize();i++)
{
QVERIFY(downer->downloading(i));
QVERIFY(downer->download(i)->getNumDownloaders() == 32 / csel->criticialWindowSize());
}
for (Uint32 i = 0;i < 32;i++)
{
QVERIFY(dd[i].getNumGrabbed() == 1);
}
for (Uint32 i = 0;i < 32;i++)
{
downer->removePieceDownloader(&dd[i]);
}
// cleanup
tc.setChunkSelector(0);
}