Downloader::close() is called in destructor

This commit is contained in:
Veloman Yunkan 2024-06-28 12:50:56 +04:00
parent c46cd403ae
commit e8afcbe6ae
1 changed files with 10 additions and 1 deletions

View File

@ -151,11 +151,20 @@ Downloader::Downloader() :
/* Destructor */
Downloader::~Downloader()
{
close();
}
void Downloader::close()
{
mp_aria->close();
if ( mp_aria ) {
try {
mp_aria->close();
} catch (const std::exception& err) {
std::cerr << "ERROR: Failed to save the downloader state: "
<< err.what() << std::endl;
}
mp_aria.reset();
}
}
std::vector<std::string> Downloader::getDownloadIds() const {