소스 검색

Release elements in routineCommands_ on destruction

Tatsuhiro Tsujikawa 12 년 전
부모
커밋
fc0982587b
2개의 변경된 파일9개의 추가작업 그리고 8개의 파일을 삭제
  1. 9 6
      src/DownloadEngine.cc
  2. 0 2
      src/DownloadEngine.h

+ 9 - 6
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)

+ 0 - 2
src/DownloadEngine.h

@@ -183,8 +183,6 @@ public:
   // processed. Otherwise, returns 0.
   int run(bool oneshot=false);
 
-  void cleanQueue();
-
   bool addSocketForReadCheck(const SharedHandle<SocketCore>& socket,
                              Command* command);
   bool deleteSocketForReadCheck(const SharedHandle<SocketCore>& socket,