diff --git a/ChangeLog b/ChangeLog index 486e97a2..b9f1ec43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-05-10 Tatsuhiro Tsujikawa + + Pool connection when CWD, SIZE command fails. + * src/FtpNegotiationCommand.cc + * src/FtpNegotiationCommand.h + 2008-05-10 Tatsuhiro Tsujikawa Renamed HttpNullDownloadCommand as HttpSkipResponseCommand diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index 1d1870b8..c50da417 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -193,6 +193,7 @@ bool FtpNegotiationCommand::recvCwd() { return false; } if(status != 250) { + poolConnection(); throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str()); } sequence = SEQ_SEND_SIZE; @@ -212,6 +213,7 @@ bool FtpNegotiationCommand::recvSize() { return false; } if(status != 213) { + poolConnection(); throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str()); } if(size > INT64_MAX) { @@ -241,10 +243,8 @@ bool FtpNegotiationCommand::recvSize() { BtProgressInfoFileHandle infoFile(new DefaultBtProgressInfoFile(_requestGroup->getDownloadContext(), _requestGroup->getPieceStorage(), e->option)); if(!infoFile->exists() && _requestGroup->downloadFinishedByFileLength()) { sequence = SEQ_DOWNLOAD_ALREADY_COMPLETED; - // We can pool socket here - std::pair peerInfo; - socket->getPeerInfo(peerInfo); - e->poolSocket(peerInfo.first, peerInfo.second, socket); + + poolConnection(); return false; } @@ -436,4 +436,13 @@ bool FtpNegotiationCommand::processSequence(const SegmentHandle& segment) { return doNextSequence; } +void FtpNegotiationCommand::poolConnection() const +{ + if(e->option->getAsBool(PREF_FTP_REUSE_CONNECTION)) { + std::pair peerInfo; + socket->getPeerInfo(peerInfo); + e->poolSocket(peerInfo.first, peerInfo.second, socket); + } +} + } // namespace aria2 diff --git a/src/FtpNegotiationCommand.h b/src/FtpNegotiationCommand.h index efefa836..962b1999 100644 --- a/src/FtpNegotiationCommand.h +++ b/src/FtpNegotiationCommand.h @@ -98,6 +98,8 @@ private: void afterFileAllocation(); + void poolConnection() const; + SharedHandle dataSocket; SharedHandle serverSocket; Seq sequence;