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_poll.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_poll.cpp')
-rw-r--r-- | src/socketengines/socketengine_poll.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index 6f50e2798..a72d21d1f 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -63,7 +63,7 @@ static int mask_to_poll(int event_mask) int rv = 0; if (event_mask & (FD_WANT_POLL_READ | FD_WANT_FAST_READ)) rv |= POLLIN; - 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)) rv |= POLLOUT; return rv; } @@ -208,7 +208,10 @@ int PollEngine::DispatchEvents() if (events[index].revents & POLLOUT) { - SetEventMask(eh, eh->GetEventMask() & ~FD_WRITE_WILL_BLOCK); + int mask = eh->GetEventMask(); + mask &= ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE); + SetEventMask(eh, mask); + events[index].events = mask_to_poll(mask); eh->HandleEvent(EVENT_WRITE); } } |