summaryrefslogtreecommitdiff
path: root/src/socketengine_epoll.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-18 18:16:47 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-18 18:16:47 +0000
commit8b41eadd920668bc17f543e39bb40f9ee96c098b (patch)
treefbc50baeb1b9e9d93d9a6bd1edf6d8b414461ac1 /src/socketengine_epoll.cpp
parent0738c47225c7c6291f8d449c3238e9bf5abd8e1a (diff)
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
Diffstat (limited to 'src/socketengine_epoll.cpp')
-rw-r--r--src/socketengine_epoll.cpp12
1 files changed, 9 insertions, 3 deletions
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;
}