Chromium Code Reviews| Index: runtime/bin/socket_patch.dart |
| diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart |
| index c866977f29ad60b7ac3b771a39e57f68add1782f..7d940f282279082286d9b72110afeb8c5710e3a7 100644 |
| --- a/runtime/bin/socket_patch.dart |
| +++ b/runtime/bin/socket_patch.dart |
| @@ -287,6 +287,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject { |
| bool isClosed = false; |
| bool isClosing = false; |
| bool isClosedRead = false; |
| + bool closedReadEventSent = false; |
| bool isClosedWrite = false; |
| Completer closeCompleter = new Completer.sync(); |
| @@ -694,6 +695,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject { |
| } |
| void issueReadEvent() { |
| + if (closedReadEventSent) return; |
| if (readEventIssued) return; |
| readEventIssued = true; |
| void issue() { |
| @@ -701,10 +703,11 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject { |
| if (isClosing) return; |
| if (!sendReadEvents) return; |
| if (available == 0) { |
| - if (isClosedRead) { |
| + if (isClosedRead && !closedReadEventSent) { |
| if (isClosedWrite) close(); |
| var handler = eventHandlers[CLOSED_EVENT]; |
| if (handler == null) return; |
| + closedReadEventSent = true; |
| handler(); |
| } |
| return; |
| @@ -860,7 +863,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject { |
| void shutdownWrite() { |
| if (!isClosing && !isClosed) { |
| - if (isClosedRead) { |
| + if (closedReadEventSent) { |
| close(); |
| } else { |
| sendToEventHandler(1 << SHUTDOWN_WRITE_COMMAND); |
| @@ -1350,6 +1353,7 @@ class _RawSocket extends Stream<RawSocketEvent> |
| factory _RawSocket._writePipe() { |
| var native = new _NativeSocket.pipe(); |
| native.isClosedRead = true; |
| + native.closedReadEventSent = true; |
|
Bill Hesse
2015/03/04 12:37:34
Added to CL, to fix broken Process.stdin tests.
|
| return new _RawSocket(native); |
| } |