mirror of https://github.com/aria2/aria2
Run on-bt-download-complete command when -V reports download finished
See GH-355pull/364/head
parent
7f9bb0e2da
commit
b324be70ad
|
@ -40,6 +40,9 @@
|
||||||
#include "DiskAdaptor.h"
|
#include "DiskAdaptor.h"
|
||||||
#include "prefs.h"
|
#include "prefs.h"
|
||||||
#include "Option.h"
|
#include "Option.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "SingletonHolder.h"
|
||||||
|
#include "Notifier.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -72,12 +75,17 @@ void BtCheckIntegrityEntry::onDownloadIncomplete
|
||||||
void BtCheckIntegrityEntry::onDownloadFinished
|
void BtCheckIntegrityEntry::onDownloadFinished
|
||||||
(std::vector<std::unique_ptr<Command>>& commands, DownloadEngine* e)
|
(std::vector<std::unique_ptr<Command>>& commands, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
|
auto group = getRequestGroup();
|
||||||
|
const auto& option = group->getOption();
|
||||||
|
util::executeHookByOptName(group, option.get(), PREF_ON_BT_DOWNLOAD_COMPLETE);
|
||||||
|
SingletonHolder<Notifier>::instance()->notifyDownloadEvent
|
||||||
|
(EVENT_ON_BT_DOWNLOAD_COMPLETE, group);
|
||||||
// TODO Currently,when all the checksums
|
// TODO Currently,when all the checksums
|
||||||
// are valid, then aria2 goes to seeding mode. Sometimes it is better
|
// are valid, then aria2 goes to seeding mode. Sometimes it is better
|
||||||
// to exit rather than doing seeding. So, it would be good to toggle this
|
// to exit rather than doing seeding. So, it would be good to toggle this
|
||||||
// behavior.
|
// behavior.
|
||||||
if(!getRequestGroup()->getOption()->getAsBool(PREF_HASH_CHECK_ONLY) &&
|
if(!option->getAsBool(PREF_HASH_CHECK_ONLY) &&
|
||||||
getRequestGroup()->getOption()->getAsBool(PREF_BT_HASH_CHECK_SEED)) {
|
option->getAsBool(PREF_BT_HASH_CHECK_SEED)) {
|
||||||
proceedFileAllocation(commands,
|
proceedFileAllocation(commands,
|
||||||
make_unique<BtFileAllocationEntry>
|
make_unique<BtFileAllocationEntry>
|
||||||
(getRequestGroup()),
|
(getRequestGroup()),
|
||||||
|
|
Loading…
Reference in New Issue