mirror of
https://github.com/aria2/aria2.git
synced 2025-04-04 21:17:41 +03:00
Fix infinite loop when size of downloadResults_ exceeds maxDownloadResult_
This commit is contained in:
parent
2aeb7137d0
commit
a49397ed19
5 changed files with 43 additions and 20 deletions
|
@ -34,6 +34,7 @@ class RequestGroupManTest : public CppUnit::TestFixture {
|
|||
CPPUNIT_TEST(testFillRequestGroupFromReserver);
|
||||
CPPUNIT_TEST(testFillRequestGroupFromReserver_uriParser);
|
||||
CPPUNIT_TEST(testInsertReservedGroup);
|
||||
CPPUNIT_TEST(testAddDownloadResult);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
private:
|
||||
SharedHandle<DownloadEngine> e_;
|
||||
|
@ -64,6 +65,7 @@ public:
|
|||
void testFillRequestGroupFromReserver();
|
||||
void testFillRequestGroupFromReserver_uriParser();
|
||||
void testInsertReservedGroup();
|
||||
void testAddDownloadResult();
|
||||
};
|
||||
|
||||
|
||||
|
@ -289,4 +291,17 @@ void RequestGroupManTest::testInsertReservedGroup()
|
|||
CPPUNIT_ASSERT_EQUAL(rgs2[1]->getGID(), (*itr++).second->getGID());
|
||||
}
|
||||
|
||||
void RequestGroupManTest::testAddDownloadResult()
|
||||
{
|
||||
std::string uri = "http://example.org";
|
||||
rgman_->setMaxDownloadResult(3);
|
||||
rgman_->addDownloadResult(createDownloadResult(error_code::TIME_OUT, uri));
|
||||
rgman_->addDownloadResult(createDownloadResult(error_code::FINISHED, uri));
|
||||
rgman_->addDownloadResult(createDownloadResult(error_code::FINISHED, uri));
|
||||
rgman_->addDownloadResult(createDownloadResult(error_code::FINISHED, uri));
|
||||
rgman_->addDownloadResult(createDownloadResult(error_code::FINISHED, uri));
|
||||
CPPUNIT_ASSERT_EQUAL(error_code::TIME_OUT,
|
||||
rgman_->getDownloadStat().getLastErrorResult());
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue