diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-15 22:50:51 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-15 22:50:51 +0900 |
| commit | fc0982587bc78648c918ae83deacca3e90d7e809 (patch) | |
| tree | 7c69f686e40f5925e17fc15e05a218f207c7bcbf /src/DownloadEngine.cc | |
| parent | cef6db17ba08f40f39b879a9e1a7b71af1374df4 (diff) | |
Release elements in routineCommands_ on destruction
Diffstat (limited to 'src/DownloadEngine.cc')
| -rw-r--r-- | src/DownloadEngine.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc index 71607ca0..18aa963b 100644 --- a/src/DownloadEngine.cc +++ b/src/DownloadEngine.cc @@ -107,18 +107,21 @@ DownloadEngine::DownloadEngine(const SharedHandle<EventPoll>& eventPoll) 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() { - cleanQueue(); + cleanQueue(commands_); + cleanQueue(routineCommands_); #ifdef HAVE_ARES_ADDR_NODE setAsyncDNSServers(0); #endif // HAVE_ARES_ADDR_NODE } -void DownloadEngine::cleanQueue() { - std::for_each(commands_.begin(), commands_.end(), Deleter()); - commands_.clear(); -} - namespace { void executeCommand(std::deque<Command*>& commands, Command::STATUS statusFilter) |
