From af98861aff50737f87d9c251ee9a68280bba3e64 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 11 Nov 2015 22:31:00 +0900 Subject: Evict timed out pooled socket periodically Previously we only scanned pool socket to check they are timed out when we pooled another socket. This means that pooled socket is not closed long time (stays in CLOSE-WAIT state) if we don't pool any more socket. In this commit, we now check pooled socket periodically (30 seconds) to avoid the sockets hanging in CLOSE-WAIT state long time. See GH-477 --- src/DownloadEngineFactory.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/DownloadEngineFactory.cc') diff --git a/src/DownloadEngineFactory.cc b/src/DownloadEngineFactory.cc index 6f07c2f6..8bc96e19 100644 --- a/src/DownloadEngineFactory.cc +++ b/src/DownloadEngineFactory.cc @@ -57,6 +57,7 @@ #include "a2io.h" #include "DownloadContext.h" #include "array_fun.h" +#include "EvictSocketPoolCommand.h" #ifdef HAVE_LIBUV # include "LibuvEventPoll.h" #endif // HAVE_LIBUV @@ -164,6 +165,8 @@ DownloadEngineFactory::newDownloadEngine e->addRoutineCommand(make_unique (e->newCUID(), e->getCheckIntegrityMan().get(), e.get())); + e->addRoutineCommand(make_unique + (e->newCUID(), e.get(), 30_s)); if(op->getAsInt(PREF_AUTO_SAVE_INTERVAL) > 0) { e->addRoutineCommand(make_unique( -- cgit