summaryrefslogtreecommitdiff
path: root/src/DownloadCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-05-09 14:44:28 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-05-09 14:44:28 +0000
commitf25436725e2dd2a0d3ddb672415b0991ce4f2ce0 (patch)
tree1327033b5c2d4d99d5cde6114744495c44346517 /src/DownloadCommand.cc
parent0b5e827ead424ff0a5de43bc707b52abb4badfcb (diff)
2008-05-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added the ability to reuse connection in FTP and it is enabled by default. It can be disabled by --ftp-reuse-connection=false option. * src/Command.cc * src/DownloadCommand.cc * src/FtpDownloadCommand.cc * src/FtpDownloadCommand.h * src/FtpFinishDownloadCommand.cc * src/FtpFinishDownloadCommand.h * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpNegotiationCommand.h * src/HelpItemFactory.cc * src/Makefile.am * src/Makefile.in * src/OptionHandlerFactory.cc * src/option_processing.cc * src/prefs.h * src/usage_text.h
Diffstat (limited to 'src/DownloadCommand.cc')
-rw-r--r--src/DownloadCommand.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/DownloadCommand.cc b/src/DownloadCommand.cc
index bd98519a..d2137dd6 100644
--- a/src/DownloadCommand.cc
+++ b/src/DownloadCommand.cc
@@ -178,13 +178,17 @@ bool DownloadCommand::prepareForNextSegment() {
#endif // ENABLE_MESSAGE_DIGEST
return true;
} else {
- SegmentHandle tempSegment = _segments.front();
- SegmentHandle nextSegment =
- _requestGroup->getSegmentMan()->getSegment(cuid,
- tempSegment->getIndex()+1);
- if(!nextSegment.isNull() && nextSegment->getWrittenLength() == 0) {
- e->commands.push_back(this);
- return false;
+ if(_segments.size()) {
+ SegmentHandle tempSegment = _segments.front();
+ SegmentHandle nextSegment =
+ _requestGroup->getSegmentMan()->getSegment(cuid,
+ tempSegment->getIndex()+1);
+ if(!nextSegment.isNull() && nextSegment->getWrittenLength() == 0) {
+ e->commands.push_back(this);
+ return false;
+ } else {
+ return prepareForRetry(0);
+ }
} else {
return prepareForRetry(0);
}