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

Unified Diff: runtime/bin/socket_impl.dart

Issue 8270001: Fix the handling of exceptions from process start (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed print Created 9 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 | « runtime/bin/process_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_impl.dart
diff --git a/runtime/bin/socket_impl.dart b/runtime/bin/socket_impl.dart
index c4f5616de825952b0a9322acb3ae31c46090b2a6..585a4dfd06ad78a03ac484c58b7327a0f1908ccc 100644
--- a/runtime/bin/socket_impl.dart
+++ b/runtime/bin/socket_impl.dart
@@ -25,7 +25,7 @@ class _SocketBase {
_handlerMap = new List(_CLOSE_EVENT + 1);
_handlerMask = 0;
_canActivateHandlers = true;
- _id = 0;
+ _id = -1;
_handler.receive((var message, ignored) {
_multiplex(message);
});
@@ -92,10 +92,18 @@ class _SocketBase {
if (_id >= 0) {
EventHandler._sendData(_id, _handler, 1 << _CLOSE_COMMAND);
_handler.close();
+ _handler = null;
_id = -1;
} else {
- throw new
- SocketIOException("Error: close failed - invalid socket handle");
+ // This is to support closing sockets created but never assigned
+ // any actual socket.
+ if (_handler == null) {
+ throw new
+ SocketIOException("Error: close failed - invalid socket handle");
+ } else {
+ _handler.close();
+ _handler = null;
+ }
}
}
« no previous file with comments | « runtime/bin/process_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698