summaryrefslogtreecommitdiff
path: root/src/AbstractCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-09-09 12:00:42 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-09-09 12:00:42 +0000
commitd687886c24eb0d8325e0568f4a6ed304c4011966 (patch)
treef236533ed580c999a32525392f2261bf02eacb2c /src/AbstractCommand.cc
parent420500f6bf53e0fafc6660deaa014b425af13fe7 (diff)
2010-09-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Moved connectedHostname, connectedAddr and connectedPort to Request object. Mark cached IP address bad on timeout to allow aria2 to renew IP address cache. * src/AbstractCommand.cc * src/AbstractProxyRequestCommand.cc * src/AbstractProxyRequestCommand.h * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpNegotiationCommand.h * src/HttpInitiateConnectionCommand.cc * src/HttpRequestCommand.cc * src/HttpRequestCommand.h * src/InitiateConnectionCommand.cc * src/InitiateConnectionCommand.h * src/Request.cc * src/Request.h
Diffstat (limited to 'src/AbstractCommand.cc')
-rw-r--r--src/AbstractCommand.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc
index 078b884e..1ab93d00 100644
--- a/src/AbstractCommand.cc
+++ b/src/AbstractCommand.cc
@@ -242,12 +242,29 @@ bool AbstractCommand::execute() {
} else {
if(checkPoint_.difference(global::wallclock) >= timeout_) {
// timeout triggers ServerStat error state.
-
SharedHandle<ServerStat> ss =
e_->getRequestGroupMan()->getOrCreateServerStat(req_->getHost(),
req_->getProtocol());
ss->setError();
-
+ // Purging IP address cache to renew IP address.
+ if(getLogger()->debug()) {
+ getLogger()->debug("CUID#%s - Marking IP address %s as bad",
+ util::itos(getCuid()).c_str(),
+ req_->getConnectedAddr().c_str());
+ }
+ e_->markBadIPAddress(req_->getConnectedHostname(),
+ req_->getConnectedAddr(),
+ req_->getConnectedPort());
+ if(e_->findCachedIPAddress
+ (req_->getConnectedHostname(), req_->getConnectedPort()).empty()) {
+ if(getLogger()->debug()) {
+ getLogger()->debug("CUID#%s - All IP addresses were marked bad."
+ " Removing Entry.",
+ util::itos(getCuid()).c_str());
+ }
+ e_->removeCachedIPAddress
+ (req_->getConnectedHostname(), req_->getConnectedPort());
+ }
throw DL_RETRY_EX2(EX_TIME_OUT, downloadresultcode::TIME_OUT);
}
e_->addCommand(this);