mirror of https://github.com/aria2/aria2
Fix on-download-error is executed even if download succeeded
parent
008aba66d5
commit
52c68c431d
|
@ -236,16 +236,24 @@ void executeStopHook
|
||||||
const Option* option,
|
const Option* option,
|
||||||
error_code::Value result)
|
error_code::Value result)
|
||||||
{
|
{
|
||||||
if(result == error_code::FINISHED &&
|
PrefPtr hookPref = nullptr;
|
||||||
!option->blank(PREF_ON_DOWNLOAD_COMPLETE)) {
|
if(!option->blank(PREF_ON_DOWNLOAD_STOP)) {
|
||||||
util::executeHookByOptName(group, option, PREF_ON_DOWNLOAD_COMPLETE);
|
hookPref = PREF_ON_DOWNLOAD_STOP;
|
||||||
} else if(result != error_code::IN_PROGRESS &&
|
|
||||||
result != error_code::REMOVED &&
|
|
||||||
!option->blank(PREF_ON_DOWNLOAD_ERROR)) {
|
|
||||||
util::executeHookByOptName(group, option, PREF_ON_DOWNLOAD_ERROR);
|
|
||||||
} else if(!option->blank(PREF_ON_DOWNLOAD_STOP)) {
|
|
||||||
util::executeHookByOptName(group, option, PREF_ON_DOWNLOAD_STOP);
|
|
||||||
}
|
}
|
||||||
|
if(result == error_code::FINISHED) {
|
||||||
|
if(!option->blank(PREF_ON_DOWNLOAD_COMPLETE)) {
|
||||||
|
hookPref = PREF_ON_DOWNLOAD_COMPLETE;
|
||||||
|
}
|
||||||
|
} else if(result != error_code::IN_PROGRESS &&
|
||||||
|
result != error_code::REMOVED) {
|
||||||
|
if(!option->blank(PREF_ON_DOWNLOAD_ERROR)) {
|
||||||
|
hookPref = PREF_ON_DOWNLOAD_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(hookPref) {
|
||||||
|
util::executeHookByOptName(group, option, hookPref);
|
||||||
|
}
|
||||||
|
|
||||||
if(result == error_code::FINISHED) {
|
if(result == error_code::FINISHED) {
|
||||||
notifyDownloadEvent(EVENT_ON_DOWNLOAD_COMPLETE, group);
|
notifyDownloadEvent(EVENT_ON_DOWNLOAD_COMPLETE, group);
|
||||||
} else if(result != error_code::IN_PROGRESS &&
|
} else if(result != error_code::IN_PROGRESS &&
|
||||||
|
|
Loading…
Reference in New Issue