mirror of https://github.com/aria2/aria2
2007-10-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that prevents remote Metalink/Torrent file from begin processed. * src/RequestGroupMan.cc (removeStoppedGroup) Added debug message. * src/BtPostDownloadHandler.cc * src/MetalinkPostDownloadHandler.cc * src/PostDownloadHandler.{h, cc} * src/RequestGroup.ccpull/1/head
parent
c0b467273c
commit
0ead885da5
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2007-10-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Fixed the bug that prevents remote Metalink/Torrent file from begin
|
||||||
|
processed.
|
||||||
|
* src/RequestGroupMan.cc (removeStoppedGroup)
|
||||||
|
|
||||||
|
Added debug message.
|
||||||
|
* src/BtPostDownloadHandler.cc
|
||||||
|
* src/MetalinkPostDownloadHandler.cc
|
||||||
|
* src/PostDownloadHandler.{h, cc}
|
||||||
|
* src/RequestGroup.cc
|
||||||
|
|
||||||
2007-10-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2007-10-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
* src/Request.cc (parseUrl): Removed unnecessary slashes around dir.
|
* src/Request.cc (parseUrl): Removed unnecessary slashes around dir.
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "prefs.h"
|
#include "prefs.h"
|
||||||
#include "RequestGroup.h"
|
#include "RequestGroup.h"
|
||||||
#include "Option.h"
|
#include "Option.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
BtPostDownloadHandler::BtPostDownloadHandler(const Option* option):
|
BtPostDownloadHandler::BtPostDownloadHandler(const Option* option):
|
||||||
PostDownloadHandler(".torrent", option)
|
PostDownloadHandler(".torrent", option)
|
||||||
|
@ -46,6 +47,7 @@ BtPostDownloadHandler::~BtPostDownloadHandler() {}
|
||||||
|
|
||||||
RequestGroups BtPostDownloadHandler::getNextRequestGroups(const string& path)
|
RequestGroups BtPostDownloadHandler::getNextRequestGroups(const string& path)
|
||||||
{
|
{
|
||||||
|
_logger->debug("Generating RequestGroups for Torrent file %s", path.c_str());
|
||||||
RequestGroupHandle rg = new RequestGroup(_option, Strings());
|
RequestGroupHandle rg = new RequestGroup(_option, Strings());
|
||||||
DefaultBtContextHandle btContext = new DefaultBtContext();
|
DefaultBtContextHandle btContext = new DefaultBtContext();
|
||||||
btContext->load(path);
|
btContext->load(path);
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "MetalinkPostDownloadHandler.h"
|
#include "MetalinkPostDownloadHandler.h"
|
||||||
#include "RequestGroup.h"
|
#include "RequestGroup.h"
|
||||||
#include "Metalink2RequestGroup.h"
|
#include "Metalink2RequestGroup.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
MetalinkPostDownloadHandler::MetalinkPostDownloadHandler(const Option* option):
|
MetalinkPostDownloadHandler::MetalinkPostDownloadHandler(const Option* option):
|
||||||
PostDownloadHandler(".metalink", option)
|
PostDownloadHandler(".metalink", option)
|
||||||
|
@ -44,5 +45,6 @@ MetalinkPostDownloadHandler::~MetalinkPostDownloadHandler() {}
|
||||||
|
|
||||||
RequestGroups MetalinkPostDownloadHandler::getNextRequestGroups(const string& path)
|
RequestGroups MetalinkPostDownloadHandler::getNextRequestGroups(const string& path)
|
||||||
{
|
{
|
||||||
|
_logger->debug("Generating RequestGroups for Metalink file %s", path.c_str());
|
||||||
return Metalink2RequestGroup(_option).generate(path);
|
return Metalink2RequestGroup(_option).generate(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
/* copyright --> */
|
/* copyright --> */
|
||||||
#include "PostDownloadHandler.h"
|
#include "PostDownloadHandler.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
#include "LogFactory.h"
|
||||||
|
|
||||||
PostDownloadHandler::PostDownloadHandler(const string& extension, const Option* option):_extension(extension), _option(option)
|
PostDownloadHandler::PostDownloadHandler(const string& extension, const Option* option):_extension(extension), _option(option), _logger(LogFactory::getInstance()) {}
|
||||||
{}
|
|
||||||
|
|
||||||
PostDownloadHandler::~PostDownloadHandler() {}
|
PostDownloadHandler::~PostDownloadHandler() {}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ class Option;
|
||||||
class RequestGroup;
|
class RequestGroup;
|
||||||
typedef SharedHandle<RequestGroup> RequestGroupHandle;
|
typedef SharedHandle<RequestGroup> RequestGroupHandle;
|
||||||
typedef deque<RequestGroupHandle> RequestGroups;
|
typedef deque<RequestGroupHandle> RequestGroups;
|
||||||
|
class Logger;
|
||||||
|
|
||||||
class PostDownloadHandler
|
class PostDownloadHandler
|
||||||
{
|
{
|
||||||
|
@ -48,6 +49,7 @@ private:
|
||||||
string _extension;
|
string _extension;
|
||||||
protected:
|
protected:
|
||||||
const Option* _option;
|
const Option* _option;
|
||||||
|
const Logger* _logger;
|
||||||
public:
|
public:
|
||||||
PostDownloadHandler(const string& extension, const Option* option);
|
PostDownloadHandler(const string& extension, const Option* option);
|
||||||
|
|
||||||
|
|
|
@ -409,12 +409,14 @@ void RequestGroup::releaseRuntimeResource()
|
||||||
|
|
||||||
RequestGroups RequestGroup::postDownloadProcessing()
|
RequestGroups RequestGroup::postDownloadProcessing()
|
||||||
{
|
{
|
||||||
|
_logger->debug("Finding PostDownloadHandler for path %s.", getFilePath().c_str());
|
||||||
for(PostDownloadHandlers::const_iterator itr = _postDownloadHandlers.begin();
|
for(PostDownloadHandlers::const_iterator itr = _postDownloadHandlers.begin();
|
||||||
itr != _postDownloadHandlers.end(); ++itr) {
|
itr != _postDownloadHandlers.end(); ++itr) {
|
||||||
if((*itr)->canHandle(getFilePath())) {
|
if((*itr)->canHandle(getFilePath())) {
|
||||||
return (*itr)->getNextRequestGroups(getFilePath());
|
return (*itr)->getNextRequestGroups(getFilePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_logger->debug("No PostDownloadHandler found.");
|
||||||
return RequestGroups();
|
return RequestGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,12 +102,15 @@ void RequestGroupMan::removeStoppedGroup()
|
||||||
temp.push_back(*itr);
|
temp.push_back(*itr);
|
||||||
} else {
|
} else {
|
||||||
(*itr)->closeFile();
|
(*itr)->closeFile();
|
||||||
RequestGroups nextGroups = (*itr)->postDownloadProcessing();
|
|
||||||
|
|
||||||
if((*itr)->downloadFinished()) {
|
if((*itr)->downloadFinished()) {
|
||||||
_logger->notice(MSG_FILE_DOWNLOAD_COMPLETED,
|
_logger->notice(MSG_FILE_DOWNLOAD_COMPLETED,
|
||||||
(*itr)->getFilePath().c_str());
|
(*itr)->getFilePath().c_str());
|
||||||
(*itr)->getProgressInfoFile()->removeFile();
|
(*itr)->getProgressInfoFile()->removeFile();
|
||||||
|
RequestGroups nextGroups = (*itr)->postDownloadProcessing();
|
||||||
|
if(nextGroups.size() > 0) {
|
||||||
|
_logger->debug("Adding %d RequestGroups as a result of PostDownloadHandler.", (int32_t)nextGroups.size());
|
||||||
|
copy(nextGroups.rbegin(), nextGroups.rend(), front_inserter(_reservedGroups));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
(*itr)->getProgressInfoFile()->save();
|
(*itr)->getProgressInfoFile()->save();
|
||||||
|
|
Loading…
Reference in New Issue