OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * The [SecureServerSocket] is a server socket, providing a stream of high-level | 8 * The [SecureServerSocket] is a server socket, providing a stream of high-level |
9 * [Socket]s. | 9 * [Socket]s. |
10 * | 10 * |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 address, | 57 address, |
58 port, | 58 port, |
59 backlog, | 59 backlog, |
60 certificateName, | 60 certificateName, |
61 requestClientCertificate: requestClientCertificate, | 61 requestClientCertificate: requestClientCertificate, |
62 requireClientCertificate: requireClientCertificate).then( | 62 requireClientCertificate: requireClientCertificate).then( |
63 (serverSocket) => new SecureServerSocket._(serverSocket)); | 63 (serverSocket) => new SecureServerSocket._(serverSocket)); |
64 } | 64 } |
65 | 65 |
66 StreamSubscription<SecureSocket> listen(void onData(SecureSocket socket), | 66 StreamSubscription<SecureSocket> listen(void onData(SecureSocket socket), |
67 {void onError(AsyncError error), | 67 {void onError(error), |
68 void onDone(), | 68 void onDone(), |
69 bool cancelOnError}) { | 69 bool cancelOnError}) { |
70 return _socket.map((rawSocket) => new SecureSocket._(rawSocket)) | 70 return _socket.map((rawSocket) => new SecureSocket._(rawSocket)) |
71 .listen(onData, | 71 .listen(onData, |
72 onError: onError, | 72 onError: onError, |
73 onDone: onDone, | 73 onDone: onDone, |
74 cancelOnError: cancelOnError); | 74 cancelOnError: cancelOnError); |
75 } | 75 } |
76 | 76 |
77 /** | 77 /** |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 bool requireClientCertificate: false}) { | 152 bool requireClientCertificate: false}) { |
153 return RawServerSocket.bind(address, port, backlog) | 153 return RawServerSocket.bind(address, port, backlog) |
154 .then((serverSocket) => new RawSecureServerSocket._( | 154 .then((serverSocket) => new RawSecureServerSocket._( |
155 serverSocket, | 155 serverSocket, |
156 certificateName, | 156 certificateName, |
157 requestClientCertificate, | 157 requestClientCertificate, |
158 requireClientCertificate)); | 158 requireClientCertificate)); |
159 } | 159 } |
160 | 160 |
161 StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s), | 161 StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s), |
162 {void onError(AsyncError error), | 162 {void onError(error), |
163 void onDone(), | 163 void onDone(), |
164 bool cancelOnError}) { | 164 bool cancelOnError}) { |
165 return _controller.stream.listen(onData, | 165 return _controller.stream.listen(onData, |
166 onError: onError, | 166 onError: onError, |
167 onDone: onDone, | 167 onDone: onDone, |
168 cancelOnError: cancelOnError); | 168 cancelOnError: cancelOnError); |
169 } | 169 } |
170 | 170 |
171 /** | 171 /** |
172 * Returns the port used by this socket. | 172 * Returns the port used by this socket. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 _subscription = _socket.listen(_onData, | 228 _subscription = _socket.listen(_onData, |
229 onDone: _onDone, | 229 onDone: _onDone, |
230 onError: _onError); | 230 onError: _onError); |
231 } else { | 231 } else { |
232 close(); | 232 close(); |
233 } | 233 } |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 | 237 |
OLD | NEW |