summaryrefslogtreecommitdiff
path: root/src/AbstractCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-10-15 23:27:51 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-10-15 23:27:51 +0900
commit4a4fec2c8c17dad5d1983adeb1857c1a082e75f0 (patch)
treee004dd02edcc41d08833b62f147a8cc59a0e4d2d /src/AbstractCommand.cc
parent841395f3321763368ad64d70e3835be33c92a845 (diff)
Removed socket readability check from checkIfConnectionEstablished()
Diffstat (limited to 'src/AbstractCommand.cc')
-rw-r--r--src/AbstractCommand.cc48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc
index 8a61701c..35d1b0d1 100644
--- a/src/AbstractCommand.cc
+++ b/src/AbstractCommand.cc
@@ -833,32 +833,30 @@ bool AbstractCommand::checkIfConnectionEstablished
const std::string& connectedAddr,
uint16_t connectedPort)
{
- if(socket->isReadable(0)) {
- std::string error = socket->getSocketError();
- if(!error.empty()) {
- // See also InitiateConnectionCommand::executeInternal()
- e_->markBadIPAddress(connectedHostname, connectedAddr, connectedPort);
- if(!e_->findCachedIPAddress(connectedHostname, connectedPort).empty()) {
- A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY,
- getCuid(),
- connectedAddr.c_str(), connectedPort));
- Command* command =
- InitiateConnectionCommandFactory::createInitiateConnectionCommand
- (getCuid(), req_, fileEntry_, requestGroup_, e_);
- e_->setNoWait(true);
- 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_->getRequestGroupMan()->getOrCreateServerStat
- (req_->getHost(), req_->getProtocol())->setError();
- }
- throw DL_RETRY_EX
- (fmt(MSG_ESTABLISHING_CONNECTION_FAILED, error.c_str()));
+ std::string error = socket->getSocketError();
+ if(!error.empty()) {
+ // See also InitiateConnectionCommand::executeInternal()
+ e_->markBadIPAddress(connectedHostname, connectedAddr, connectedPort);
+ if(!e_->findCachedIPAddress(connectedHostname, connectedPort).empty()) {
+ A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY,
+ getCuid(),
+ connectedAddr.c_str(), connectedPort));
+ Command* command =
+ InitiateConnectionCommandFactory::createInitiateConnectionCommand
+ (getCuid(), req_, fileEntry_, requestGroup_, e_);
+ e_->setNoWait(true);
+ 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_->getRequestGroupMan()->getOrCreateServerStat
+ (req_->getHost(), req_->getProtocol())->setError();
}
+ throw DL_RETRY_EX
+ (fmt(MSG_ESTABLISHING_CONNECTION_FAILED, error.c_str()));
}
return true;
}