2008-05-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Pool connection when CWD, SIZE command fails.
	* src/FtpNegotiationCommand.cc
	* src/FtpNegotiationCommand.h
pull/1/head
Tatsuhiro Tsujikawa 2008-05-10 05:14:35 +00:00
parent 10b1ddd2c0
commit e71b09a9dc
3 changed files with 21 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2008-05-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Pool connection when CWD, SIZE command fails.
* src/FtpNegotiationCommand.cc
* src/FtpNegotiationCommand.h
2008-05-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Renamed HttpNullDownloadCommand as HttpSkipResponseCommand

View File

@ -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<std::string, uint16_t> 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<std::string, uint16_t> peerInfo;
socket->getPeerInfo(peerInfo);
e->poolSocket(peerInfo.first, peerInfo.second, socket);
}
}
} // namespace aria2

View File

@ -98,6 +98,8 @@ private:
void afterFileAllocation();
void poolConnection() const;
SharedHandle<SocketCore> dataSocket;
SharedHandle<SocketCore> serverSocket;
Seq sequence;