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

Unified Diff: runtime/bin/eventhandler_android.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 | « no previous file | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_android.cc
diff --git a/runtime/bin/eventhandler_android.cc b/runtime/bin/eventhandler_android.cc
index d70f2d87239a71e83afdf63f3a080b1b8aa791e2..ebc41a57de7d84167512cbca025602fac8d9b54b 100644
--- a/runtime/bin/eventhandler_android.cc
+++ b/runtime/bin/eventhandler_android.cc
@@ -43,7 +43,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;
}
@@ -65,7 +65,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,
@@ -252,7 +255,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 | « no previous file | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698