mirror of
https://github.com/aria2/aria2.git
synced 2025-04-06 22:17:38 +03:00
Eliminated few seconds delay when downloads stop or pause.
The delay is caused because some Commands are only called in certain interval(called refreshInterval, default, 1000ms). In aria2 download stops when all Commands associated to it are stopped. Since some Commands are called in each 1000ms by default, as mentioned before, we have to wait for them. To fix this issue, we call DownloadEngine::setRefreshInterval(0) when pausing/stopping downloads. DownloadEngine::setRefreshInterval(0) makes refreshInterval 0 in one shot. When all segments are ignored, now DownloadFailureException is thrown. And stop the download immediately. As described earlier, we call DownloadEngine::setRefreshInterval(0) in catch block of DownloadFailureException to eliminate delay.
This commit is contained in:
parent
7d14491389
commit
49b49c351a
8 changed files with 32 additions and 7 deletions
|
@ -395,6 +395,7 @@ SharedHandle<ValueBase> removeDownload
|
|||
} else {
|
||||
group->setHaltRequested(true, RequestGroup::USER_REQUEST);
|
||||
}
|
||||
e->setRefreshInterval(0);
|
||||
}
|
||||
return createGIDResponse(gid);
|
||||
}
|
||||
|
@ -452,6 +453,7 @@ SharedHandle<ValueBase> pauseDownload
|
|||
group = e->getRequestGroupMan()->findReservedGroup(gid);
|
||||
}
|
||||
if(group && pauseRequestGroup(group, reserved, forcePause)) {
|
||||
e->setRefreshInterval(0);
|
||||
return createGIDResponse(gid);
|
||||
} else {
|
||||
throw DL_ABORT_EX
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue