diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-06-08 14:11:36 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-06-08 14:11:36 +0000 |
| commit | 7cd9b21937c42606354610c7ae85a0857b474cf5 (patch) | |
| tree | 21edec9e14d7bde8cfa705840a6e9756b732e1e5 /src/AbstractCommand.cc | |
| parent | 2dc4bf01ad3b9be3de22696128e8007cf81a5345 (diff) | |
2010-06-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Made public member variables of DownloadEngine private. Added
accessor funcs.
Diffstat (limited to 'src/AbstractCommand.cc')
| -rw-r--r-- | src/AbstractCommand.cc | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index 337babdd..10423400 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -66,6 +66,8 @@ #include "DownloadContext.h" #include "wallclock.h" #include "NameResolver.h" +#include "ServerStatMan.h" +#include "FileAllocationEntry.h" namespace aria2 { @@ -134,7 +136,7 @@ bool AbstractCommand::execute() { InitiateConnectionCommandFactory::createInitiateConnectionCommand (cuid, fasterRequest, _fileEntry, _requestGroup, e); e->setNoWait(true); - e->commands.push_back(command); + e->addCommand(command); return true; } } @@ -204,13 +206,13 @@ bool AbstractCommand::execute() { // timeout triggers ServerStat error state. SharedHandle<ServerStat> ss = - e->_requestGroupMan->getOrCreateServerStat(req->getHost(), - req->getProtocol()); + e->getRequestGroupMan()->getOrCreateServerStat(req->getHost(), + req->getProtocol()); ss->setError(); throw DL_RETRY_EX2(EX_TIME_OUT, downloadresultcode::TIME_OUT); } - e->commands.push_back(this); + e->addCommand(this); return false; } } catch(DlAbortEx& err) { @@ -318,11 +320,11 @@ bool AbstractCommand::prepareForRetry(time_t wait) { Command* command = new CreateRequestCommand(cuid, _requestGroup, e); if(wait == 0) { e->setNoWait(true); - e->commands.push_back(command); + e->addCommand(command); } else { SleepCommand* scom = new SleepCommand(cuid, e, _requestGroup, command, wait); - e->commands.push_back(scom); + e->addCommand(scom); } return true; } @@ -330,8 +332,8 @@ bool AbstractCommand::prepareForRetry(time_t wait) { void AbstractCommand::onAbort() { if(!req.isNull()) { // TODO This might be a problem if the failure is caused by proxy. - e->_requestGroupMan->getOrCreateServerStat(req->getHost(), - req->getProtocol())->setError(); + e->getRequestGroupMan()->getOrCreateServerStat(req->getHost(), + req->getProtocol())->setError(); _fileEntry->removeIdenticalURI(req->getUri()); _fileEntry->removeRequest(req); } @@ -610,7 +612,7 @@ bool AbstractCommand::asyncResolveHostname() case AsyncNameResolver::STATUS_ERROR: disableNameResolverCheck(_asyncNameResolver); if(!isProxyRequest(req->getProtocol(), getOption())) { - e->_requestGroupMan->getOrCreateServerStat + e->getRequestGroupMan()->getOrCreateServerStat (req->getHost(), req->getProtocol())->setError(); } throw DL_ABORT_EX(StringFormat(MSG_NAME_RESOLUTION_FAILED, @@ -671,7 +673,7 @@ std::string AbstractCommand::resolveHostname { NameResolver res; res.setSocktype(SOCK_STREAM); - if(e->option->getAsBool(PREF_DISABLE_IPV6)) { + if(e->getOption()->getAsBool(PREF_DISABLE_IPV6)) { res.setFamily(AF_INET); } res.resolve(addrs, hostname); @@ -737,14 +739,14 @@ bool AbstractCommand::checkIfConnectionEstablished InitiateConnectionCommandFactory::createInitiateConnectionCommand (cuid, req, _fileEntry, _requestGroup, e); e->setNoWait(true); - e->commands.push_back(command); + e->addCommand(command); return false; } e->removeCachedIPAddress(connectedHostname, connectedPort); // Don't set error if proxy server is used and its method is GET. if(resolveProxyMethod(req->getProtocol()) != V_GET || !isProxyRequest(req->getProtocol(), getOption())) { - e->_requestGroupMan->getOrCreateServerStat + e->getRequestGroupMan()->getOrCreateServerStat (req->getHost(), req->getProtocol())->setError(); } throw DL_RETRY_EX |
