From 8b41eadd920668bc17f543e39bb40f9ee96c098b Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 18 Oct 2007 18:16:47 +0000 Subject: Socket engine tweaks to fix a glitch, and improvements to new m_ident git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8225 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/socketengine_epoll.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/socketengine_epoll.cpp') diff --git a/src/socketengine_epoll.cpp b/src/socketengine_epoll.cpp index 97efec127..1cf5bd8c1 100644 --- a/src/socketengine_epoll.cpp +++ b/src/socketengine_epoll.cpp @@ -40,13 +40,19 @@ bool EPollEngine::AddFd(EventHandler* eh) { int fd = eh->GetFd(); if ((fd < 0) || (fd > MAX_DESCRIPTORS)) + { + ServerInstance->Log(DEBUG,"Out of range FD"); return false; + } if (GetRemainingFds() <= 1) return false; if (ref[fd]) + { + ServerInstance->Log(DEBUG,"Ref occupied!"); return false; + } struct epoll_event ev; memset(&ev,0,sizeof(struct epoll_event)); @@ -83,6 +89,9 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force) if ((fd < 0) || (fd > MAX_DESCRIPTORS)) return false; + ref[fd] = NULL; + CurrentSetSize--; + struct epoll_event ev; memset(&ev,0,sizeof(struct epoll_event)); eh->Readable() ? ev.events = EPOLLIN : ev.events = EPOLLOUT; @@ -92,9 +101,6 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force) if (i < 0 && !force) return false; - CurrentSetSize--; - ref[fd] = NULL; - ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd); return true; } -- cgit v1.2.3