Index: sdk/lib/io/secure_socket.dart |
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart |
index 9bfa032d50fceeb4b10bada55177492ca5ce328c..8590284c9744fa4db3bc19419e2368233ea4bca0 100644 |
--- a/sdk/lib/io/secure_socket.dart |
+++ b/sdk/lib/io/secure_socket.dart |
@@ -491,17 +491,17 @@ class _RawSecureSocket extends Stream<RawSocketEvent> |
} |
_RawSecureSocket( |
- InternetAddress this.address, |
+ this.address, |
int requestedPort, |
- String this.certificateName, |
- bool this.is_server, |
+ this.certificateName, |
+ this.is_server, |
RawSocket socket, |
- StreamSubscription this._socketSubscription, |
- List<int> this._bufferedData, |
- bool this.requestClientCertificate, |
- bool this.requireClientCertificate, |
- bool this.sendClientCertificate, |
- bool this.onBadCertificate(X509Certificate certificate)) { |
+ this._socketSubscription, |
+ this._bufferedData, |
+ this.requestClientCertificate, |
+ this.requireClientCertificate, |
+ this.sendClientCertificate, |
+ this.onBadCertificate(X509Certificate certificate)) { |
_controller = new StreamController<RawSocketEvent>( |
sync: true, |
onListen: _onSubscriptionStateChange, |
@@ -535,9 +535,10 @@ class _RawSecureSocket extends Stream<RawSocketEvent> |
onError: _reportError, |
onDone: _doneHandler); |
} else { |
- _socketSubscription.onData(_eventDispatcher); |
- _socketSubscription.onError(_reportError); |
- _socketSubscription.onDone(_doneHandler); |
+ _socketSubscription |
+ ..onData(_eventDispatcher) |
+ ..onError(_reportError) |
+ ..onDone(_doneHandler); |
} |
_secureFilter.connect(address.host, |
(address as dynamic)._in_addr, |
@@ -608,8 +609,8 @@ class _RawSecureSocket extends Stream<RawSocketEvent> |
int get remotePort => _socket.remotePort; |
int available() { |
- if (_status != CONNECTED) return 0; |
- return _secureFilter.buffers[READ_PLAINTEXT].length; |
+ return _status != CONNECTED ? 0 |
+ : _secureFilter.buffers[READ_PLAINTEXT].length; |
} |
Future<RawSecureSocket> close() { |
@@ -1068,9 +1069,13 @@ class _RawSecureSocket extends Stream<RawSocketEvent> |
* and one writing. All updates to start and end are done by Dart code. |
*/ |
class _ExternalBuffer { |
+ List data; // This will be a ExternalByteArray, backed by C allocated data. |
+ int start; |
+ int end; |
+ final size; |
+ |
_ExternalBuffer(this.size) { |
- start = size~/2; |
- end = size~/2; |
+ start = end = size ~/ 2; |
} |
void advanceStart(int bytes) { |
@@ -1095,20 +1100,14 @@ class _ExternalBuffer { |
bool get isEmpty => end == start; |
- int get length { |
- if (start > end) return size + end - start; |
- return end - start; |
- } |
+ int get length => |
+ start > end ? size + end - start : end - start; |
- int get linearLength { |
- if (start > end) return size - start; |
- return end - start; |
- } |
+ int get linearLength => |
+ start > end ? size - start : end - start; |
- int get free { |
- if (start > end) return start - end - 1; |
- return size + start - end - 1; |
- } |
+ int get free => |
+ start > end ? start - end - 1 : size + start - end - 1; |
int get linearFree { |
if (start > end) return start - end - 1; |
@@ -1185,11 +1184,6 @@ class _ExternalBuffer { |
} |
} |
} |
- |
- List data; // This will be a ExternalByteArray, backed by C allocated data. |
- int start; |
- int end; |
- final size; |
} |
@@ -1232,9 +1226,7 @@ class TlsException implements IOException { |
OSError osError = null]) |
: this._("TlsException", message, osError); |
- const TlsException._(String this.type, |
- String this.message, |
- OSError this.osError); |
+ const TlsException._(this.type, this.message, this.osError); |
String toString() { |
StringBuffer sb = new StringBuffer(); |