summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkwkam <kwkam@users.noreply.github.com>2017-11-08 15:17:47 +0800
committerkwkam <kwkam@users.noreply.github.com>2017-11-08 15:17:47 +0800
commiteef212d72ae5511a36b7f6bc90cdff93ecd374aa (patch)
tree03139ebb82375d647dcc4afd437dbc672211ccd6 /src
parent3c6a70c566e19354fa8c6dbe6374471666cce72d (diff)
UnknownLengthPieceStorage: return piece length
show something in console status when downloading items with unknown content length
Diffstat (limited to 'src')
-rw-r--r--src/UnknownLengthPieceStorage.cc9
-rw-r--r--src/UnknownLengthPieceStorage.h6
2 files changed, 10 insertions, 5 deletions
diff --git a/src/UnknownLengthPieceStorage.cc b/src/UnknownLengthPieceStorage.cc
index b7e1ce84..4ea14115 100644
--- a/src/UnknownLengthPieceStorage.cc
+++ b/src/UnknownLengthPieceStorage.cc
@@ -210,6 +210,15 @@ bool UnknownLengthPieceStorage::isPieceUsed(size_t index)
}
}
+int64_t UnknownLengthPieceStorage::getCompletedLength()
+{
+ // TODO we have to return actual completed length here?
+ if (piece_) {
+ return piece_->getLength();
+ }
+ return totalLength_;
+}
+
std::shared_ptr<DiskAdaptor> UnknownLengthPieceStorage::getDiskAdaptor()
{
return diskAdaptor_;
diff --git a/src/UnknownLengthPieceStorage.h b/src/UnknownLengthPieceStorage.h
index 9c3845dd..2b05918c 100644
--- a/src/UnknownLengthPieceStorage.h
+++ b/src/UnknownLengthPieceStorage.h
@@ -162,11 +162,7 @@ public:
return totalLength_;
}
- virtual int64_t getCompletedLength() CXX11_OVERRIDE
- {
- // TODO we have to return actual completed length here?
- return totalLength_;
- }
+ virtual int64_t getCompletedLength() CXX11_OVERRIDE;
virtual int64_t getFilteredCompletedLength() CXX11_OVERRIDE
{