From 0c62e907309da29d23b669da91034d00f378bade Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 27 Feb 2010 15:04:48 +0000 Subject: [PATCH] 2010-02-28 Tatsuhiro Tsujikawa Fixed the bug that grouped FileEntry objects are not used but instead all FileEntry objects are used for each metaurl group. * src/Metalink2RequestGroup.cc * test/Metalink2RequestGroupTest.cc * test/metalink4-groupbymetaurl.xml --- ChangeLog | 8 ++++++ src/Metalink2RequestGroup.cc | 6 ++-- test/Metalink2RequestGroupTest.cc | 48 +++++++++++++++++++++++++++++++ test/metalink4-groupbymetaurl.xml | 17 +++++++++++ 4 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 test/metalink4-groupbymetaurl.xml diff --git a/ChangeLog b/ChangeLog index 7633ec61..a88ea3b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-02-28 Tatsuhiro Tsujikawa + + Fixed the bug that grouped FileEntry objects are not used but + instead all FileEntry objects are used for each metaurl group. + * src/Metalink2RequestGroup.cc + * test/Metalink2RequestGroupTest.cc + * test/metalink4-groupbymetaurl.xml + 2010-02-27 Tatsuhiro Tsujikawa Use vector instead of deque for ChunkChecksum. diff --git a/src/Metalink2RequestGroup.cc b/src/Metalink2RequestGroup.cc index e06e39aa..95edd28c 100644 --- a/src/Metalink2RequestGroup.cc +++ b/src/Metalink2RequestGroup.cc @@ -180,7 +180,7 @@ Metalink2RequestGroup::createRequestGroup } } } - std::for_each(entries.begin(), entries.end(), + std::for_each(selectedEntries.begin(), selectedEntries.end(), mem_fun_sh(&MetalinkEntry::reorderMetaurlsByPriority)); std::vector > > > entryGroups; @@ -276,8 +276,8 @@ Metalink2RequestGroup::createRequestGroup dctx->setPieceLength(option->getAsInt(PREF_SEGMENT_SIZE)); std::vector > fileEntries; off_t offset = 0; - for(std::deque >::const_iterator i = - entries.begin(); i != entries.end(); ++i) { + for(std::vector >::const_iterator i = + mes.begin(); i != mes.end(); ++i) { _logger->info("Metalink: Queueing %s for download as a member.", (*i)->getPath().c_str()); _logger->debug("originalName = %s", (*i)->metaurls[0]->name.c_str()); diff --git a/test/Metalink2RequestGroupTest.cc b/test/Metalink2RequestGroupTest.cc index defb99f8..24e317e2 100644 --- a/test/Metalink2RequestGroupTest.cc +++ b/test/Metalink2RequestGroupTest.cc @@ -16,6 +16,7 @@ class Metalink2RequestGroupTest:public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(Metalink2RequestGroupTest); CPPUNIT_TEST(testGenerate); + CPPUNIT_TEST(testGenerate_groupByMetaurl); CPPUNIT_TEST_SUITE_END(); private: SharedHandle