From 1fe0ac9a0a9d417d09c2125b6fd2c1627beea186 Mon Sep 17 00:00:00 2001 From: PHZ <2235710879@QQ.COM> Date: Thu, 27 Jan 2022 21:02:20 +0800 Subject: [PATCH] Update EpollTaskScheduler.cpp fixed file descriptor leak. --- src/net/EpollTaskScheduler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/net/EpollTaskScheduler.cpp b/src/net/EpollTaskScheduler.cpp index e73aadd..b2a0f5f 100644 --- a/src/net/EpollTaskScheduler.cpp +++ b/src/net/EpollTaskScheduler.cpp @@ -21,7 +21,12 @@ EpollTaskScheduler::EpollTaskScheduler(int id) EpollTaskScheduler::~EpollTaskScheduler() { - +#if defined(__linux) || defined(__linux__) + if (epollfd_ >= 0) { + close(epollfd_); + epollfd_ = -1; + } +#endif } void EpollTaskScheduler::UpdateChannel(ChannelPtr channel)