From 810c662c9b55908101ca085293c52c3239ef22d1 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sat, 26 Sep 2009 14:12:45 +0000 Subject: 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 --- src/socketengines/socketengine_poll.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/socketengines/socketengine_poll.cpp') 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); } } -- cgit v1.2.3