Index: runtime/bin/socket_patch.dart |
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart |
index 789dd001399664a3632d3f8e33467a49e198f5bb..1480f1f97b41ef2331744cca1e9313d799dddfc4 100644 |
--- a/runtime/bin/socket_patch.dart |
+++ b/runtime/bin/socket_patch.dart |
@@ -615,7 +615,9 @@ class _NativeSocket extends NativeFieldWrapperClass1 { |
if (isClosedRead) { |
close(); |
} else { |
+ bool connected = eventPort != null; |
sendToEventHandler(1 << SHUTDOWN_WRITE_COMMAND); |
+ if (!connected) disconnectFromEventHandler(); |
} |
isClosedWrite = true; |
} |
@@ -626,7 +628,9 @@ class _NativeSocket extends NativeFieldWrapperClass1 { |
if (isClosedWrite) { |
close(); |
} else { |
+ bool connected = eventPort != null; |
sendToEventHandler(1 << SHUTDOWN_READ_COMMAND); |
+ if (!connected) disconnectFromEventHandler(); |
} |
isClosedRead = true; |
} |