From 8e0a882551d02e29d5a1617d08c6c00100c6ce74 Mon Sep 17 00:00:00 2001 From: w00t Date: Sun, 18 Jan 2009 12:19:01 +0000 Subject: Fix what should have been the (real) problems with kqueue, so far so good for me.. this *does* need more testing though. Fix spotted by dz (check .filter, not .flags, and don't try to use it as a bitmask). TOR, ratbox, and similar projects use code like this, so I am fairly confident it is ok. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10971 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/socketengines/socketengine_kqueue.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/socketengines') diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index 411686aac..c07684506 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -126,7 +126,7 @@ int KQueueEngine::GetMaxFds() if (!MAX_DESCRIPTORS) { int mib[2], maxfiles; - size_t len; + size_t len; mib[0] = CTL_KERN; mib[1] = KERN_MAXFILES; @@ -166,7 +166,7 @@ int KQueueEngine::DispatchEvents() ref[ke_list[j].ident]->HandleEvent(EVENT_ERROR, ke_list[j].fflags); continue; } - if (ke_list[j].flags & EVFILT_WRITE) + if (ke_list[j].filter == EVFILT_WRITE) { /* This looks wrong but its right. As above, theres no modify * call in kqueue. See the manpage. @@ -181,8 +181,7 @@ int KQueueEngine::DispatchEvents() if (ref[ke_list[j].ident]) ref[ke_list[j].ident]->HandleEvent(EVENT_WRITE); } - - if (ke_list[j].flags & EVFILT_READ) + if (ke_list[j].flags == EVFILT_READ) { ReadEvents++; if (ref[ke_list[j].ident]) -- cgit v1.2.3