diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-05-06 18:23:44 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-05-06 18:31:50 +0900 |
| commit | 8897d7ec702fca9780033db42db48cced2580112 (patch) | |
| tree | a2e21a6965d96fedbbcce0c80990282c665ec581 /src/RequestGroup.h | |
| parent | e174b90ff22d9e467a169069bb9c1cbe0df50147 (diff) | |
Restart active download to apply previously not applicable options
Previously, we categorized options that can be used in
aria2.changeOption RPC method into 2 categories. The options in one
category can be applied on the fly, meaning that download continues to
be active while applying options. Another category includes options
which are only applicable when downloads are waiting or paused.
In this change, when active download is ordered to change options
which only applicable in waiting or paused state, it is now paused,
and then automatically restarted. Although we have limited number of
download concurrency, the pause and restart is done atomically, and
the download is inserted at the front of the queue, it is picked up
immediately if the concurrency regulation allows.
Diffstat (limited to 'src/RequestGroup.h')
| -rw-r--r-- | src/RequestGroup.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/RequestGroup.h b/src/RequestGroup.h index 0d94c5da..8b7862eb 100644 --- a/src/RequestGroup.h +++ b/src/RequestGroup.h @@ -96,6 +96,9 @@ private: std::shared_ptr<Option> option_; + // options applied on restart + std::shared_ptr<Option> pendingOption_; + std::shared_ptr<SegmentMan> segmentMan_; std::shared_ptr<DownloadContext> downloadContext_; @@ -178,6 +181,11 @@ private: bool pauseRequested_; + // restartRequested_ indicates that this download should be + // restarted. Usually, it is used with pauseRequested_ to stop + // download first. + bool restartRequested_; + // This flag just indicates that the downloaded file is not saved disk but // just sits in memory. bool inMemoryDownload_; @@ -345,6 +353,10 @@ public: bool isPauseRequested() const { return pauseRequested_; } + void setRestartRequested(bool f); + + bool isRestartRequested() const { return restartRequested_; } + void dependsOn(const std::shared_ptr<Dependency>& dep); bool isDependencyResolved(); @@ -500,6 +512,12 @@ public: // Returns true if this download is now seeding. bool isSeeder() const; + + void setPendingOption(std::shared_ptr<Option> option); + const std::shared_ptr<Option>& getPendingOption() const + { + return pendingOption_; + } }; } // namespace aria2 |
