summaryrefslogtreecommitdiff
path: root/src/socketengine_kqueue.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-06 19:59:09 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-06 19:59:09 +0000
commit457e12e54100eaff493595d5042fa85f00d261c5 (patch)
treee63d33f0ee0af39ca15b683a92f2b8e7c33e3717 /src/socketengine_kqueue.cpp
parent5b3a9f2af8b04bef4d2878d28e36e57ff2c907d1 (diff)
Make the socketengines always clear the slots on DelFd, even if the underlying queue call fails
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5437 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socketengine_kqueue.cpp')
-rw-r--r--src/socketengine_kqueue.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/socketengine_kqueue.cpp b/src/socketengine_kqueue.cpp
index 662be649a..15d0e30bc 100644
--- a/src/socketengine_kqueue.cpp
+++ b/src/socketengine_kqueue.cpp
@@ -70,6 +70,7 @@ bool KQueueEngine::AddFd(EventHandler* eh)
struct kevent ke;
ServerInstance->Log(DEBUG,"kqueue: Add socket to events, kq=%d socket=%d",EngineHandle,fd);
EV_SET(&ke, fd, eh->Readable() ? EVFILT_READ : EVFILT_WRITE, EV_ADD, 0, 0, NULL);
+
int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL);
if (i == -1)
{
@@ -92,6 +93,10 @@ bool KQueueEngine::DelFd(EventHandler* eh)
struct kevent ke;
EV_SET(&ke, fd, eh->Readable() ? EVFILT_READ : EVFILT_WRITE, EV_DELETE, 0, 0, NULL);
+
+ CurrentSetSize--;
+ ref[fd] = NULL;
+
int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL);
if (i == -1)
{
@@ -99,8 +104,6 @@ bool KQueueEngine::DelFd(EventHandler* eh)
return false;
}
- CurrentSetSize--;
- ref[fd] = NULL;
return true;
}