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

Unified Diff: runtime/bin/socket_patch.dart

Issue 198743002: Make the event-handler handle backpreasure. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Doc fix Created 6 years, 9 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/socket_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index 78069640d64fa1f1aedbe0964393c3aefcadf64a..0edd4680a5adf38c34851a57d25ea88ccd525484 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -355,8 +355,9 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
static const int CLOSE_COMMAND = 8;
static const int SHUTDOWN_READ_COMMAND = 9;
static const int SHUTDOWN_WRITE_COMMAND = 10;
+ static const int RETURN_TOKEN_COMMAND = 11;
static const int FIRST_COMMAND = CLOSE_COMMAND;
- static const int LAST_COMMAND = SHUTDOWN_WRITE_COMMAND;
+ static const int LAST_COMMAND = RETURN_TOKEN_COMMAND;
// Type flag send to the eventhandler providing additional
// information on the type of the file descriptor.
@@ -817,6 +818,9 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
}
}
}
+ if (eventPort != null && !isClosing && !isClosed) {
+ sendToEventHandler(1 << RETURN_TOKEN_COMMAND);
+ }
}
void setHandlers({read, write, error, closed, destroyed}) {
@@ -832,7 +836,7 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
sendWriteEvents = write;
if (read) issueReadEvent();
if (write) issueWriteEvent();
- if (eventPort == null) {
+ if (eventPort == null && !isClosing && !isClosed) {
int flags = typeFlags & TYPE_TYPE_MASK;
if (!isClosedRead) flags |= 1 << READ_EVENT;
if (!isClosedWrite) flags |= 1 << WRITE_EVENT;
@@ -889,7 +893,7 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
}
void sendToEventHandler(int data) {
- assert(!isClosed);
+ assert(!isClosing);
connectToEventHandler();
_EventHandler._sendData(this, eventPort, data);
}
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698