Index: sdk/lib/io/secure_server_socket.dart |
diff --git a/sdk/lib/io/secure_server_socket.dart b/sdk/lib/io/secure_server_socket.dart |
index 2fbc5b1224792b61f8db10365028889fc6073388..7dfdb478f396beb2533779713a080cbf9bc3dd09 100644 |
--- a/sdk/lib/io/secure_server_socket.dart |
+++ b/sdk/lib/io/secure_server_socket.dart |
@@ -62,37 +62,31 @@ class SecureServerSocket extends Stream<SecureSocket> { |
* isolates this way. |
*/ |
static Future<SecureServerSocket> bind( |
- address, |
- int port, |
- SecurityContext context, |
+ address, int port, SecurityContext context, |
{int backlog: 0, |
- bool v6Only: false, |
- bool requestClientCertificate: false, |
- bool requireClientCertificate: false, |
- List<String> supportedProtocols, |
- bool shared: false}) { |
- return RawSecureServerSocket.bind( |
- address, |
- port, |
- context, |
- backlog: backlog, |
- v6Only: v6Only, |
- requestClientCertificate: requestClientCertificate, |
- requireClientCertificate: requireClientCertificate, |
- supportedProtocols: supportedProtocols, |
- shared: shared).then( |
- (serverSocket) => new SecureServerSocket._(serverSocket)); |
+ bool v6Only: false, |
+ bool requestClientCertificate: false, |
+ bool requireClientCertificate: false, |
+ List<String> supportedProtocols, |
+ bool shared: false}) { |
+ return RawSecureServerSocket |
+ .bind(address, port, context, |
+ backlog: backlog, |
+ v6Only: v6Only, |
+ requestClientCertificate: requestClientCertificate, |
+ requireClientCertificate: requireClientCertificate, |
+ supportedProtocols: supportedProtocols, |
+ shared: shared) |
+ .then((serverSocket) => new SecureServerSocket._(serverSocket)); |
} |
StreamSubscription<SecureSocket> listen(void onData(SecureSocket socket), |
- {Function onError, |
- void onDone(), |
- bool cancelOnError}) { |
- return _socket.map((rawSocket) => new SecureSocket._(rawSocket)) |
- .listen(onData, |
- onError: onError, |
- onDone: onDone, |
- cancelOnError: cancelOnError); |
+ {Function onError, void onDone(), bool cancelOnError}) { |
+ return _socket.map((rawSocket) => new SecureSocket._(rawSocket)).listen( |
+ onData, |
+ onError: onError, |
+ onDone: onDone, |
+ cancelOnError: cancelOnError); |
} |
/** |
@@ -111,10 +105,11 @@ class SecureServerSocket extends Stream<SecureSocket> { |
*/ |
Future<SecureServerSocket> close() => _socket.close().then((_) => this); |
- void set _owner(owner) { _socket._owner = owner; } |
+ void set _owner(owner) { |
+ _socket._owner = owner; |
+ } |
} |
- |
/** |
* The RawSecureServerSocket is a server socket, providing a stream of low-level |
* [RawSecureSocket]s. |
@@ -131,11 +126,12 @@ class RawSecureServerSocket extends Stream<RawSecureSocket> { |
final List<String> supportedProtocols; |
bool _closed = false; |
- RawSecureServerSocket._(this._socket, |
- this._context, |
- this.requestClientCertificate, |
- this.requireClientCertificate, |
- this.supportedProtocols) { |
+ RawSecureServerSocket._( |
+ this._socket, |
+ this._context, |
+ this.requestClientCertificate, |
+ this.requireClientCertificate, |
+ this.supportedProtocols) { |
_controller = new StreamController<RawSecureSocket>( |
sync: true, |
onListen: _onSubscriptionStateChange, |
@@ -190,17 +186,15 @@ class RawSecureServerSocket extends Stream<RawSecureSocket> { |
* multiple isolates this way. |
*/ |
static Future<RawSecureServerSocket> bind( |
- address, |
- int port, |
- SecurityContext context, |
+ address, int port, SecurityContext context, |
{int backlog: 0, |
- bool v6Only: false, |
- bool requestClientCertificate: false, |
- bool requireClientCertificate: false, |
- List<String> supportedProtocols, |
- bool shared: false}) { |
- return RawServerSocket.bind( |
- address, port, backlog: backlog, v6Only: v6Only, shared: shared) |
+ bool v6Only: false, |
+ bool requestClientCertificate: false, |
+ bool requireClientCertificate: false, |
+ List<String> supportedProtocols, |
+ bool shared: false}) { |
+ return RawServerSocket |
+ .bind(address, port, backlog: backlog, v6Only: v6Only, shared: shared) |
.then((serverSocket) => new RawSecureServerSocket._( |
serverSocket, |
context, |
@@ -210,13 +204,9 @@ class RawSecureServerSocket extends Stream<RawSecureSocket> { |
} |
StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s), |
- {Function onError, |
- void onDone(), |
- bool cancelOnError}) { |
+ {Function onError, void onDone(), bool cancelOnError}) { |
return _controller.stream.listen(onData, |
- onError: onError, |
- onDone: onDone, |
- cancelOnError: cancelOnError); |
+ onError: onError, onDone: onDone, cancelOnError: cancelOnError); |
} |
/** |
@@ -247,16 +237,15 @@ class RawSecureServerSocket extends Stream<RawSecureSocket> { |
// Do nothing - connection is closed. |
return; |
} |
- _RawSecureSocket.connect( |
- connection.address, |
- remotePort, |
- context: _context, |
- is_server: true, |
- socket: connection, |
- requestClientCertificate: requestClientCertificate, |
- requireClientCertificate: requireClientCertificate, |
- supportedProtocols: supportedProtocols) |
- .then((RawSecureSocket secureConnection) { |
+ _RawSecureSocket |
+ .connect(connection.address, remotePort, |
+ context: _context, |
+ is_server: true, |
+ socket: connection, |
+ requestClientCertificate: requestClientCertificate, |
+ requireClientCertificate: requireClientCertificate, |
+ supportedProtocols: supportedProtocols) |
+ .then((RawSecureSocket secureConnection) { |
if (_closed) { |
secureConnection.close(); |
} else { |
@@ -280,8 +269,7 @@ class RawSecureServerSocket extends Stream<RawSecureSocket> { |
void _onSubscriptionStateChange() { |
if (_controller.hasListener) { |
_subscription = _socket.listen(_onData, |
- onError: _controller.addError, |
- onDone: _controller.close); |
+ onError: _controller.addError, onDone: _controller.close); |
} else { |
close(); |
} |
@@ -291,5 +279,3 @@ class RawSecureServerSocket extends Stream<RawSecureSocket> { |
(_socket as dynamic)._owner = owner; |
} |
} |
- |
- |