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

Unified Diff: sdk/lib/io/secure_socket.dart

Issue 158773002: Change RawSocket.secureServer and RawSoccket.secure to fail on paused subscriptions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 6 years, 10 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/raw_secure_server_socket_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/secure_socket.dart
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart
index 8590284c9744fa4db3bc19419e2368233ea4bca0..b3c70636f8d4c1ae9138e54e91d8194c2b57df10 100644
--- a/sdk/lib/io/secure_socket.dart
+++ b/sdk/lib/io/secure_socket.dart
@@ -263,10 +263,11 @@ abstract class RawSecureSocket implements RawSocket {
* connection is prepared for TLS handshake.
*
* If the [socket] already has a subscription, pass the existing
- * subscription in the [subscription] parameter. The secure socket
- * will take over the subscription and process any subsequent
- * events. In most cases calling `pause` on this subscription before
- * starting TLS handshake is the right thing to do.
+ * subscription in the [subscription] parameter. The [secure]
+ * operation will take over the subscription by replacing the
+ * handlers with it own secure processing. The caller must not touch
+ * this subscription anymore. Passing a paused subscription is an
+ * error.
*
* If the [host] argument is passed it will be used as the host name
* for the TLS handshake. If [host] is not passed the host name from
@@ -310,9 +311,11 @@ abstract class RawSecureSocket implements RawSocket {
* connection is going to start the TLS handshake.
*
* If the [socket] already has a subscription, pass the existing
- * subscription in the [subscription] parameter. The secure socket
- * will take over the subscription and process any subsequent
- * events.
+ * subscription in the [subscription] parameter. The [secureServer]
+ * operation will take over the subscription by replacing the
+ * handlers with it own secure processing. The caller must not touch
+ * this subscription anymore. Passing a paused subscription is an
+ * error.
*
* If some of the data of the TLS handshake has already been read
* from the socket this data can be passed in the [bufferedData]
@@ -535,6 +538,9 @@ class _RawSecureSocket extends Stream<RawSocketEvent>
onError: _reportError,
onDone: _doneHandler);
} else {
+ if (_socketSubscription.isPaused) {
+ throw new StateError("Subscription passed to TLS upgrade is paused");
+ }
_socketSubscription
..onData(_eventDispatcher)
..onError(_reportError)
« no previous file with comments | « no previous file | tests/standalone/io/raw_secure_server_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698