Unverified Commit 2304a65c authored by Dennis Jenkins's avatar Dennis Jenkins Committed by GitHub

Merge pull request #650 from mohsenomidi/master

close non-closed file descriptor will resolve : #38, #43, #150, #164, #221 - shutdown will work properly 
parents c2ac7133 91f39ec2
...@@ -99,6 +99,7 @@ struct Event { ...@@ -99,6 +99,7 @@ struct Event {
class Epoll { class Epoll {
public: public:
Epoll(); Epoll();
~Epoll();
void addFd(Fd fd, Flags<NotifyOn> interest, Tag tag, Mode mode = Mode::Level); void addFd(Fd fd, Flags<NotifyOn> interest, Tag tag, Mode mode = Mode::Level);
void addFdOneShot(Fd fd, Flags<NotifyOn> interest, Tag tag, Mode mode = Mode::Level); void addFdOneShot(Fd fd, Flags<NotifyOn> interest, Tag tag, Mode mode = Mode::Level);
......
...@@ -147,6 +147,14 @@ namespace Polling { ...@@ -147,6 +147,14 @@ namespace Polling {
epoll_fd = TRY_RET(epoll_create(Const::MaxEvents)); epoll_fd = TRY_RET(epoll_create(Const::MaxEvents));
} }
Epoll::~Epoll()
{
if (epoll_fd >= 0)
{
close(epoll_fd);
}
}
void void
Epoll::addFd(Fd fd, Flags<NotifyOn> interest, Tag tag, Mode mode) { Epoll::addFd(Fd fd, Flags<NotifyOn> interest, Tag tag, Mode mode) {
struct epoll_event ev; struct epoll_event ev;
......
...@@ -100,6 +100,12 @@ Listener::~Listener() { ...@@ -100,6 +100,12 @@ Listener::~Listener() {
shutdown(); shutdown();
if (acceptThread.joinable()) if (acceptThread.joinable())
acceptThread.join(); acceptThread.join();
if (listen_fd >= 0)
{
close(listen_fd);
listen_fd = -1;
}
#ifdef PISTACHE_USE_SSL #ifdef PISTACHE_USE_SSL
if (this->useSSL_) if (this->useSSL_)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment