Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: runtime/bin/eventhandler_macos.cc

Issue 234843003: Make server-sockets level triggered. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix platforms. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/eventhandler_linux.cc ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_macos.cc
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index 1da8702ff37c76833266e59d1d2721304bd7bcc7..3a4379012ed79c508d80069886b9f900b33f0afb 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -63,12 +63,16 @@ static void AddToKqueue(intptr_t kqueue_fd_, SocketData* sd) {
static const intptr_t kMaxChanges = 2;
intptr_t changes = 0;
struct kevent events[kMaxChanges];
+ int flags = EV_ADD;
+ if (!sd->IsListeningSocket()) {
+ flags |= EV_CLEAR;
+ }
// Register or unregister READ filter if needed.
if (sd->HasReadEvent()) {
EV_SET(events + changes,
sd->fd(),
EVFILT_READ,
- EV_ADD | EV_CLEAR,
+ flags,
0,
0,
sd);
@@ -79,7 +83,7 @@ static void AddToKqueue(intptr_t kqueue_fd_, SocketData* sd) {
EV_SET(events + changes,
sd->fd(),
EVFILT_WRITE,
- EV_ADD | EV_CLEAR,
+ flags,
0,
0,
sd);
@@ -310,7 +314,7 @@ void EventHandlerImplementation::HandleEvents(struct kevent* events,
SocketData* sd = reinterpret_cast<SocketData*>(events[i].udata);
intptr_t event_mask = GetEvents(events + i, sd);
if (event_mask != 0) {
- if (!sd->IsListeningSocket() && sd->TakeToken()) {
+ if (sd->TakeToken()) {
// Took last token, remove from epoll.
RemoveFromKqueue(kqueue_fd_, sd);
}
« no previous file with comments | « runtime/bin/eventhandler_linux.cc ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698