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

Unified Diff: runtime/bin/socket_patch.dart

Issue 239613002: Fix *ServerSocket's handling of zones. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « no previous file | tests/standalone/io/http_server_test.dart » ('j') | 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 b46bf5ea4ca0aaee21e7d78918d0ce9ccdeb5e01..f31975e30242d672173abe8f9ab049b68b4e9098 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -1068,7 +1068,15 @@ class _RawServerSocket extends Stream<RawSocket>
.then((socket) => new _RawServerSocket(socket));
}
- _RawServerSocket(this._socket) {
+ _RawServerSocket(this._socket);
+
+ StreamSubscription<RawSocket> listen(void onData(RawSocket event),
+ {Function onError,
+ void onDone(),
+ bool cancelOnError}) {
+ if (_controller != null) {
+ throw new StateError("Stream was already listened to");
+ }
var zone = Zone.current;
_controller = new StreamController(sync: true,
onListen: _onSubscriptionStateChange,
@@ -1087,14 +1095,7 @@ class _RawServerSocket extends Stream<RawSocket>
_controller.addError(e);
_controller.close();
}),
- destroyed: _controller.close
- );
- }
-
- StreamSubscription<RawSocket> listen(void onData(RawSocket event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
+ destroyed: _controller.close);
return _controller.stream.listen(
onData,
onError: onError,
« no previous file with comments | « no previous file | tests/standalone/io/http_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698