Index: sdk/lib/io/secure_socket.dart |
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart |
index cf8dec0eb80aa287d07e544611304a26d36b0c80..c271d77794f12673e56372aed54a7ba0279b3739 100644 |
--- a/sdk/lib/io/secure_socket.dart |
+++ b/sdk/lib/io/secure_socket.dart |
@@ -970,8 +970,16 @@ class _RawSecureSocket extends Stream<RawSocketEvent> |
return _IOService._dispatch(_SSL_PROCESS_FILTER, args).then((response) { |
if (response.length == 2) { |
- _reportError(new TlsException('${response[1]} error ${response[0]}'), |
- null); |
+ if (wasInHandshake) { |
+ // If we're in handshake, throw a handshake error. |
+ _reportError( |
+ new HandshakeException('${response[1]} error ${response[0]}'), |
+ null); |
+ } else { |
+ // If we're connected, throw a TLS error. |
+ _reportError(new TlsException('${response[1]} error ${response[0]}'), |
+ null); |
+ } |
} |
int start(int index) => response[2 * index]; |
int end(int index) => response[2 * index + 1]; |