summaryrefslogtreecommitdiff
path: root/src/UnknownLengthPieceStorage.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-07-15 23:36:10 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-07-15 23:36:10 +0900
commita6b7bd03421b09c87c48c56440be35060d53d1fd (patch)
treef89b5a991bc70996b786f374e74564b07419f5b0 /src/UnknownLengthPieceStorage.h
parent98681552fc811b797045851ff5b921d31dc5ca5f (diff)
Show bitfield for unknown length download in aria2.tellStatus RPC method
Generally, bitfield is not available for download whose total length is unknown. We create bitfield when download is completed (usually connection EOF) so that we can use it to show additional info in RPC aria2.tellStatus response. Specifically, bitfield is now shown. And completedLength under files key (or completedLength in aria2.getFiles() response) is correctly shown.
Diffstat (limited to 'src/UnknownLengthPieceStorage.h')
-rw-r--r--src/UnknownLengthPieceStorage.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/UnknownLengthPieceStorage.h b/src/UnknownLengthPieceStorage.h
index 5aad9667..d39f3cae 100644
--- a/src/UnknownLengthPieceStorage.h
+++ b/src/UnknownLengthPieceStorage.h
@@ -43,6 +43,7 @@ class Option;
class DownloadContext;
class DiskWriterFactory;
class DirectDiskAdaptor;
+class BitfieldMan;
class UnknownLengthPieceStorage:public PieceStorage {
private:
@@ -54,9 +55,14 @@ private:
int64_t totalLength_;
+ std::unique_ptr<BitfieldMan> bitfield_;
+
bool downloadFinished_;
std::shared_ptr<Piece> piece_;
+
+ void createBitfield();
+
public:
UnknownLengthPieceStorage(const std::shared_ptr<DownloadContext>& downloadContext);
@@ -203,18 +209,12 @@ public:
*/
virtual void initStorage() CXX11_OVERRIDE;
- virtual const unsigned char* getBitfield() CXX11_OVERRIDE
- {
- return nullptr;
- }
+ virtual const unsigned char* getBitfield() CXX11_OVERRIDE;
virtual void setBitfield(const unsigned char* bitfield,
size_t bitfieldLength) CXX11_OVERRIDE {}
- virtual size_t getBitfieldLength() CXX11_OVERRIDE
- {
- return 0;
- }
+ virtual size_t getBitfieldLength() CXX11_OVERRIDE;
virtual bool isSelectiveDownloadingMode() CXX11_OVERRIDE
{