summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-03-22 17:58:13 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-03-22 17:58:13 +0900
commitb324be70ad452b499b9afdd3f604eeb3a7328b57 (patch)
tree2b3d52cacd8fdf7beab0da4406c6706006a1e252
parent7f9bb0e2da6365863f7c144117e5dbfa5f9aa3cf (diff)
Run on-bt-download-complete command when -V reports download finished
See GH-355
-rw-r--r--src/BtCheckIntegrityEntry.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/BtCheckIntegrityEntry.cc b/src/BtCheckIntegrityEntry.cc
index 6accc0db..b25c4462 100644
--- a/src/BtCheckIntegrityEntry.cc
+++ b/src/BtCheckIntegrityEntry.cc
@@ -40,6 +40,9 @@
#include "DiskAdaptor.h"
#include "prefs.h"
#include "Option.h"
+#include "util.h"
+#include "SingletonHolder.h"
+#include "Notifier.h"
namespace aria2 {
@@ -72,12 +75,17 @@ void BtCheckIntegrityEntry::onDownloadIncomplete
void BtCheckIntegrityEntry::onDownloadFinished
(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
// 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
// behavior.
- if(!getRequestGroup()->getOption()->getAsBool(PREF_HASH_CHECK_ONLY) &&
- getRequestGroup()->getOption()->getAsBool(PREF_BT_HASH_CHECK_SEED)) {
+ if(!option->getAsBool(PREF_HASH_CHECK_ONLY) &&
+ option->getAsBool(PREF_BT_HASH_CHECK_SEED)) {
proceedFileAllocation(commands,
make_unique<BtFileAllocationEntry>
(getRequestGroup()),