diff --git a/Socket.cpp b/Socket.cpp index 522202a..7872f84 100644 --- a/Socket.cpp +++ b/Socket.cpp @@ -61,6 +61,7 @@ namespace core { void Socket::onUnregistered() {} bool Socket::eventReceived(struct epoll_event event) { + inHandler = true; if(event.events & EPOLLRDHUP) { readHangup = true; shutdown("hangup received"); @@ -75,6 +76,7 @@ namespace core { else if(event.events & EPOLLHUP) { shutdown(); } + inHandler = false; return !shutDown; } @@ -137,6 +139,8 @@ namespace core { outlock.lock(); fifo.emplace(data); outlock.unlock(); + if(!inHandler) + ePoll.resetSocket(this); return 1; } diff --git a/Socket.h b/Socket.h index 9700bcd..d0049c0 100644 --- a/Socket.h +++ b/Socket.h @@ -170,7 +170,7 @@ namespace core { // std::mutex lock; std::mutex outlock; bool readHangup = false; - + bool inHandler = false; // struct epoll_event event; // Event selection construction structure. //-------------------------------------------------------------------------------------