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/EvictSocketPoolCommand.h | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/EvictSocketPoolCommand.h (limited to 'src/EvictSocketPoolCommand.h') diff --git a/src/EvictSocketPoolCommand.h b/src/EvictSocketPoolCommand.h new file mode 100644 index 00000000..c118a393 --- /dev/null +++ b/src/EvictSocketPoolCommand.h @@ -0,0 +1,53 @@ +/* */ +#ifndef D_EVICT_SOCKET_POOL_COMMAND_H +#define D_EVICT_SOCKET_POOL_COMMAND_H + +#include "TimeBasedCommand.h" + +namespace aria2 { + +class EvictSocketPoolCommand : public TimeBasedCommand { +public: + EvictSocketPoolCommand(cuid_t cuid, DownloadEngine* e, + std::chrono::seconds interval); + virtual ~EvictSocketPoolCommand(); + virtual void preProcess() CXX11_OVERRIDE; + virtual void process() CXX11_OVERRIDE; +}; + +} // namespace aria2 + +#endif // D_EVICT_SOCKET_POOL_COMMAND_H -- cgit