From 62e7254fbe791dc61ebbca0ab3c228f5c1e48994 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 10 Jun 2013 01:10:15 +0200 Subject: Fix high CPU use on Windows when connecting to a server When getting a write event for an EventHandler that wanted a single write only, remove it from the WriteSet (socketengine_select) Fixes #556 reported by @WindowsUser --- src/socketengines/socketengine_select.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp index eba54a7cb..c21b200c2 100644 --- a/src/socketengines/socketengine_select.cpp +++ b/src/socketengines/socketengine_select.cpp @@ -179,7 +179,9 @@ int SelectEngine::DispatchEvents() if (has_write) { WriteEvents++; - SetEventMask(ev, ev->GetEventMask() & ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE)); + int newmask = (ev->GetEventMask() & ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE)); + this->OnSetEvent(ev, ev->GetEventMask(), newmask); + SetEventMask(ev, newmask); ev->HandleEvent(EVENT_WRITE); } } -- cgit v1.2.3