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

Unified Diff: dart/runtime/bin/eventhandler_linux.cc

Issue 665823007: Several bugfixes in dart:io's handing of sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added two spaces as requested Created 6 years, 2 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 | « dart/runtime/bin/eventhandler_linux.h ('k') | dart/runtime/bin/eventhandler_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/runtime/bin/eventhandler_linux.cc
diff --git a/dart/runtime/bin/eventhandler_linux.cc b/dart/runtime/bin/eventhandler_linux.cc
index 0701810a55bbc135d5533b4239d11c2114dc8e93..97b305b61e39d05aff432978f25ef07cf846879a 100644
--- a/dart/runtime/bin/eventhandler_linux.cc
+++ b/dart/runtime/bin/eventhandler_linux.cc
@@ -199,20 +199,17 @@ void EventHandlerImplementation::HandleInterruptFd() {
} else {
SocketData* sd = GetSocketData(
msg[i].id, (msg[i].data & (1 << kListeningSocket)) != 0);
- if ((msg[i].data & (1 << kShutdownReadCommand)) != 0) {
- ASSERT(msg[i].data == (1 << kShutdownReadCommand));
+ if (IS_COMMAND(msg[i].data, kShutdownReadCommand)) {
ASSERT(!sd->IsListeningSocket());
// Close the socket for reading.
VOID_NO_RETRY_EXPECTED(shutdown(sd->fd(), SHUT_RD));
- } else if ((msg[i].data & (1 << kShutdownWriteCommand)) != 0) {
- ASSERT(msg[i].data == (1 << kShutdownWriteCommand));
+ } else if (IS_COMMAND(msg[i].data, kShutdownWriteCommand)) {
ASSERT(!sd->IsListeningSocket());
// Close the socket for writing.
VOID_NO_RETRY_EXPECTED(shutdown(sd->fd(), SHUT_WR));
- } else if ((msg[i].data & (1 << kCloseCommand)) != 0) {
- ASSERT(msg[i].data == (1 << kCloseCommand));
- // Close the socket and free system resources and move on to
- // next message.
+ } else if (IS_COMMAND(msg[i].data, kCloseCommand)) {
+ // Close the socket and free system resources and move on to next
+ // message.
if (sd->RemovePort(msg[i].dart_port)) {
RemoveFromEpollInstance(epoll_fd_, sd);
intptr_t fd = sd->fd();
@@ -221,12 +218,13 @@ void EventHandlerImplementation::HandleInterruptFd() {
delete sd;
}
DartUtils::PostInt32(msg[i].dart_port, 1 << kDestroyedEvent);
- } else if ((msg[i].data & (1 << kReturnTokenCommand)) != 0) {
- int count = msg[i].data & ((1 << kReturnTokenCommand) - 1);
+ } else if (IS_COMMAND(msg[i].data, kReturnTokenCommand)) {
+ int count = TOKEN_COUNT(msg[i].data);
if (sd->ReturnToken(msg[i].dart_port, count)) {
AddToEpollInstance(epoll_fd_, sd);
}
} else {
+ ASSERT_NO_COMMAND(msg[i].data);
// Setup events to wait for.
if (sd->AddPort(msg[i].dart_port)) {
sd->SetMask(msg[i].data);
« no previous file with comments | « dart/runtime/bin/eventhandler_linux.h ('k') | dart/runtime/bin/eventhandler_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698