summaryrefslogtreecommitdiff
path: root/src/DownloadCommand.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/DownloadCommand.cc')
-rw-r--r--src/DownloadCommand.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/DownloadCommand.cc b/src/DownloadCommand.cc
index e2bcf335..b01e2c40 100644
--- a/src/DownloadCommand.cc
+++ b/src/DownloadCommand.cc
@@ -304,14 +304,15 @@ bool DownloadCommand::prepareForNextSegment() {
if(!tempSegment->complete()) {
return prepareForRetry(0);
}
+ SharedHandle<SegmentMan> segmentMan = _requestGroup->getSegmentMan();
SharedHandle<Segment> nextSegment =
- _requestGroup->getSegmentMan()->getSegment(cuid,
- tempSegment->getIndex()+1);
- if(!nextSegment.isNull() && nextSegment->getWrittenLength() == 0) {
+ segmentMan->getCleanSegmentIfOwnerIsIdle
+ (cuid, tempSegment->getIndex()+1);
+ if(nextSegment.isNull()) {
+ return prepareForRetry(0);
+ } else {
e->commands.push_back(this);
return false;
- } else {
- return prepareForRetry(0);
}
} else {
return prepareForRetry(0);