| Index: runtime/bin/socket_patch.dart
|
| diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
|
| index 4f285503c20c4cf2a2bbe6ef5138b22e70e6e315..7cb36c8305d81e3b38a356f5c18c833cda84797e 100644
|
| --- a/runtime/bin/socket_patch.dart
|
| +++ b/runtime/bin/socket_patch.dart
|
| @@ -286,6 +286,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
| // Handlers and receive port for socket events from the event handler.
|
| final List eventHandlers = new List(EVENT_COUNT + 1);
|
| RawReceivePort eventPort;
|
| + bool flagsSent = false;
|
|
|
| // The type flags for this socket.
|
| final int typeFlags;
|
| @@ -457,6 +458,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
| port: port);
|
| }
|
| if (port != 0) socket.localPort = port;
|
| + socket.connectToEventHandler();
|
| return socket;
|
| });
|
| }
|
| @@ -759,7 +761,8 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
| }
|
|
|
| void returnTokens(int tokenBatchSize) {
|
| - if (eventPort != null && !isClosing && !isClosed) {
|
| + if (!isClosing && !isClosed) {
|
| + assert(eventPort != null);
|
| // Return in batches.
|
| if (tokens == tokenBatchSize) {
|
| assert(tokens < (1 << FIRST_COMMAND));
|
| @@ -782,7 +785,8 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
| sendWriteEvents = write;
|
| if (read) issueReadEvent();
|
| if (write) issueWriteEvent();
|
| - if (eventPort == null && !isClosing) {
|
| + if (!flagsSent && !isClosing) {
|
| + flagsSent = true;
|
| int flags = typeFlags & TYPE_TYPE_MASK;
|
| if (!isClosedRead) flags |= 1 << READ_EVENT;
|
| if (!isClosedWrite) flags |= 1 << WRITE_EVENT;
|
|
|