diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-06-10 01:10:15 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-06-10 01:10:15 +0200 |
commit | 62e7254fbe791dc61ebbca0ab3c228f5c1e48994 (patch) | |
tree | 6382e75b5e3386e866e648e414967da2b66d5d42 /src/socketengines/socketengine_select.cpp | |
parent | e0ff94b310e9b73ac0131e9df14fb7ca2bf3a878 (diff) |
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
Diffstat (limited to 'src/socketengines/socketengine_select.cpp')
-rw-r--r-- | src/socketengines/socketengine_select.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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); } } |