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

Unified Diff: runtime/bin/eventhandler_linux.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_android.cc ('k') | runtime/bin/eventhandler_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_linux.cc
diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc
index 020cfc98054b421d8121fecd9b493e67041f6a47..709f97d6cc0467de778a21b55aee15c0cb43d673 100644
--- a/runtime/bin/eventhandler_linux.cc
+++ b/runtime/bin/eventhandler_linux.cc
@@ -36,7 +36,7 @@ static const int kShutdownId = -2;
intptr_t SocketData::GetPollEvents() {
// Do not ask for EPOLLERR and EPOLLHUP explicitly as they are
// triggered anyway.
- intptr_t events = EPOLLET | EPOLLRDHUP;
+ intptr_t events = 0;
if ((mask_ & (1 << kInEvent)) != 0) {
events |= EPOLLIN;
}
@@ -58,7 +58,10 @@ static void RemoveFromEpollInstance(intptr_t epoll_fd_, SocketData* sd) {
static void AddToEpollInstance(intptr_t epoll_fd_, SocketData* sd) {
struct epoll_event event;
- event.events = sd->GetPollEvents();
+ event.events = EPOLLRDHUP | sd->GetPollEvents();
+ if (!sd->IsListeningSocket()) {
+ event.events |= EPOLLET;
+ }
event.data.ptr = sd;
int status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_,
EPOLL_CTL_ADD,
@@ -279,7 +282,7 @@ void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
SocketData* sd = reinterpret_cast<SocketData*>(events[i].data.ptr);
intptr_t event_mask = GetPollEvents(events[i].events, sd);
if (event_mask != 0) {
- if (!sd->IsListeningSocket() && sd->TakeToken()) {
+ if (sd->TakeToken()) {
// Took last token, remove from epoll.
RemoveFromEpollInstance(epoll_fd_, sd);
}
« no previous file with comments | « runtime/bin/eventhandler_android.cc ('k') | runtime/bin/eventhandler_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698