mirror of https://github.com/aria2/aria2
Release elements in routineCommands_ on destruction
parent
cef6db17ba
commit
fc0982587b
|
@ -107,18 +107,21 @@ DownloadEngine::DownloadEngine(const SharedHandle<EventPoll>& eventPoll)
|
||||||
sessionId_.assign(&sessionId[0], & sessionId[sizeof(sessionId)]);
|
sessionId_.assign(&sessionId[0], & sessionId[sizeof(sessionId)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
void cleanQueue(std::deque<Command*>& commands) {
|
||||||
|
std::for_each(commands.begin(), commands.end(), Deleter());
|
||||||
|
commands.clear();
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
DownloadEngine::~DownloadEngine() {
|
DownloadEngine::~DownloadEngine() {
|
||||||
cleanQueue();
|
cleanQueue(commands_);
|
||||||
|
cleanQueue(routineCommands_);
|
||||||
#ifdef HAVE_ARES_ADDR_NODE
|
#ifdef HAVE_ARES_ADDR_NODE
|
||||||
setAsyncDNSServers(0);
|
setAsyncDNSServers(0);
|
||||||
#endif // HAVE_ARES_ADDR_NODE
|
#endif // HAVE_ARES_ADDR_NODE
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadEngine::cleanQueue() {
|
|
||||||
std::for_each(commands_.begin(), commands_.end(), Deleter());
|
|
||||||
commands_.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void executeCommand(std::deque<Command*>& commands,
|
void executeCommand(std::deque<Command*>& commands,
|
||||||
Command::STATUS statusFilter)
|
Command::STATUS statusFilter)
|
||||||
|
|
|
@ -183,8 +183,6 @@ public:
|
||||||
// processed. Otherwise, returns 0.
|
// processed. Otherwise, returns 0.
|
||||||
int run(bool oneshot=false);
|
int run(bool oneshot=false);
|
||||||
|
|
||||||
void cleanQueue();
|
|
||||||
|
|
||||||
bool addSocketForReadCheck(const SharedHandle<SocketCore>& socket,
|
bool addSocketForReadCheck(const SharedHandle<SocketCore>& socket,
|
||||||
Command* command);
|
Command* command);
|
||||||
bool deleteSocketForReadCheck(const SharedHandle<SocketCore>& socket,
|
bool deleteSocketForReadCheck(const SharedHandle<SocketCore>& socket,
|
||||||
|
|
Loading…
Reference in New Issue