mirror of https://github.com/aria2/aria2
2009-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed member _maxTries from RequestGroup class to avoid duplicate option value. Those classes who refer this variable should use option value of PREF_MAX_TRIES directly. * src/AbstractCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/TrackerWatcherCommand.ccpull/1/head
parent
06311b0baa
commit
5fe5c37897
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2009-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Removed member _maxTries from RequestGroup class to avoid
|
||||||
|
duplicate option value. Those classes who refer this variable
|
||||||
|
should use option value of PREF_MAX_TRIES directly.
|
||||||
|
* src/AbstractCommand.cc
|
||||||
|
* src/RequestGroup.cc
|
||||||
|
* src/RequestGroup.h
|
||||||
|
* src/TrackerWatcherCommand.cc
|
||||||
|
|
||||||
2009-06-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-06-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
* Release 1.4.1
|
* Release 1.4.1
|
||||||
|
|
|
@ -173,8 +173,8 @@ bool AbstractCommand::execute() {
|
||||||
cuid, req->getUrl().c_str());
|
cuid, req->getUrl().c_str());
|
||||||
req->addTryCount();
|
req->addTryCount();
|
||||||
req->resetRedirectCount();
|
req->resetRedirectCount();
|
||||||
bool isAbort = _requestGroup->getMaxTries() != 0 &&
|
const unsigned int maxTries = getOption()->getAsInt(PREF_MAX_TRIES);
|
||||||
req->getTryCount() >= _requestGroup->getMaxTries();
|
bool isAbort = maxTries != 0 && req->getTryCount() >= maxTries;
|
||||||
if(isAbort) {
|
if(isAbort) {
|
||||||
onAbort();
|
onAbort();
|
||||||
req->resetUrl();
|
req->resetUrl();
|
||||||
|
|
|
@ -130,7 +130,6 @@ RequestGroup::RequestGroup(const SharedHandle<Option>& option,
|
||||||
_lastModifiedTime(Time::null()),
|
_lastModifiedTime(Time::null()),
|
||||||
_fileNotFoundCount(0),
|
_fileNotFoundCount(0),
|
||||||
_timeout(option->getAsInt(PREF_TIMEOUT)),
|
_timeout(option->getAsInt(PREF_TIMEOUT)),
|
||||||
_maxTries(option->getAsInt(PREF_MAX_TRIES)),
|
|
||||||
_inMemoryDownload(false),
|
_inMemoryDownload(false),
|
||||||
_maxDownloadSpeedLimit(option->getAsInt(PREF_MAX_DOWNLOAD_LIMIT)),
|
_maxDownloadSpeedLimit(option->getAsInt(PREF_MAX_DOWNLOAD_LIMIT)),
|
||||||
_maxUploadSpeedLimit(option->getAsInt(PREF_MAX_UPLOAD_LIMIT)),
|
_maxUploadSpeedLimit(option->getAsInt(PREF_MAX_UPLOAD_LIMIT)),
|
||||||
|
@ -1214,11 +1213,6 @@ void RequestGroup::setTimeout(time_t timeout)
|
||||||
_timeout = timeout;
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestGroup::setMaxTries(unsigned int maxTries)
|
|
||||||
{
|
|
||||||
_maxTries = maxTries;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RequestGroup::doesDownloadSpeedExceed()
|
bool RequestGroup::doesDownloadSpeedExceed()
|
||||||
{
|
{
|
||||||
return _maxDownloadSpeedLimit > 0 &&
|
return _maxDownloadSpeedLimit > 0 &&
|
||||||
|
|
|
@ -147,9 +147,6 @@ private:
|
||||||
// Timeout used for HTTP/FTP downloads.
|
// Timeout used for HTTP/FTP downloads.
|
||||||
time_t _timeout;
|
time_t _timeout;
|
||||||
|
|
||||||
// How many times HTTP/FTP download should retry.
|
|
||||||
unsigned int _maxTries;
|
|
||||||
|
|
||||||
#ifdef ENABLE_BITTORRENT
|
#ifdef ENABLE_BITTORRENT
|
||||||
WeakHandle<BtRuntime> _btRuntime;
|
WeakHandle<BtRuntime> _btRuntime;
|
||||||
|
|
||||||
|
@ -487,13 +484,6 @@ public:
|
||||||
return _timeout;
|
return _timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMaxTries(unsigned int maxTries);
|
|
||||||
|
|
||||||
unsigned int getMaxTries() const
|
|
||||||
{
|
|
||||||
return _maxTries;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if current download speed exceeds
|
// Returns true if current download speed exceeds
|
||||||
// _maxDownloadSpeedLimit. Always returns false if
|
// _maxDownloadSpeedLimit. Always returns false if
|
||||||
// _maxDownloadSpeedLimit == 0. Otherwise returns false.
|
// _maxDownloadSpeedLimit == 0. Otherwise returns false.
|
||||||
|
|
|
@ -210,10 +210,10 @@ TrackerWatcherCommand::createRequestGroup(const std::string& uri)
|
||||||
// and if they all fails, then try next one.
|
// and if they all fails, then try next one.
|
||||||
if(backupTrackerIsAvailable(_btContext->getAnnounceTiers())) {
|
if(backupTrackerIsAvailable(_btContext->getAnnounceTiers())) {
|
||||||
logger->debug("This is multi-tracker announce.");
|
logger->debug("This is multi-tracker announce.");
|
||||||
rg->setMaxTries(2);
|
rg->getOption()->put(PREF_MAX_TRIES, "2");
|
||||||
} else {
|
} else {
|
||||||
logger->debug("This is single-tracker announce.");
|
logger->debug("This is single-tracker announce.");
|
||||||
rg->setMaxTries(5);
|
rg->getOption()->put(PREF_MAX_TRIES, "5");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::string TRACKER_ANNOUNCE_FILE("[tracker.announce]");
|
static const std::string TRACKER_ANNOUNCE_FILE("[tracker.announce]");
|
||||||
|
|
Loading…
Reference in New Issue