diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-26 14:12:45 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-26 14:12:45 +0000 |
commit | 810c662c9b55908101ca085293c52c3239ef22d1 (patch) | |
tree | a8a6877615c44dd7fde786e3a770642cab497eff /src/socketengines/socketengine_kqueue.cpp | |
parent | f0bd730338be67a7c5c8fd65ef8b4d9f851860bb (diff) |
Add FD_WANT_SINGLE_WRITE to efficiently replace FD_WANT_POLL_WRITE
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11762 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socketengines/socketengine_kqueue.cpp')
-rw-r--r-- | src/socketengines/socketengine_kqueue.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index c9734e85d..1a783153e 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -76,7 +76,7 @@ bool KQueueEngine::AddFd(EventHandler* eh, int event_mask) return false; } - if (event_mask & (FD_WANT_POLL_WRITE | FD_WANT_FAST_WRITE)) { + if (event_mask & (FD_WANT_POLL_WRITE | FD_WANT_FAST_WRITE | FD_WANT_SINGLE_WRITE)) { // ...and sometimes want to write WantWrite(eh); } @@ -148,7 +148,7 @@ void KQueueEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) eh->GetFd(), strerror(errno)); } } - if ((new_mask & FD_WANT_EDGE_WRITE) && !(old_mask & FD_WANT_EDGE_WRITE)) + if ((new_mask & (FD_WANT_FAST_WRITE | FD_WANT_SINGLE_WRITE)) && !(old_mask & (FD_WANT_FAST_WRITE | FD_WANT_SINGLE_WRITE))) { // new one-shot write struct kevent ke; @@ -184,11 +184,11 @@ int KQueueEngine::DispatchEvents() if (ke_list[j].filter == EVFILT_WRITE) { WriteEvents++; - /* When mask is FD_WANT_FAST_WRITE, we set a one-shot - * write, so we need to clear that bit to detect when it - * set again. + /* When mask is FD_WANT_FAST_WRITE or FD_WANT_SINGLE_WRITE, + * we set a one-shot write, so we need to clear that bit + * to detect when it set again. */ - const int bits_to_clr = FD_WANT_FAST_WRITE | FD_WRITE_WILL_BLOCK; + const int bits_to_clr = FD_WANT_SINGLE_WRITE | FD_WANT_FAST_WRITE | FD_WRITE_WILL_BLOCK; SetEventMask(eh, eh->GetEventMask() & ~bits_to_clr); eh->HandleEvent(EVENT_WRITE); } |