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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 * was received, the result will be null. | 60 * was received, the result will be null. |
61 */ | 61 */ |
62 static Future<SecureServerSocket> bind( | 62 static Future<SecureServerSocket> bind( |
63 address, | 63 address, |
64 int port, | 64 int port, |
65 String certificateName, | 65 String certificateName, |
66 {int backlog: 0, | 66 {int backlog: 0, |
67 bool v6Only: false, | 67 bool v6Only: false, |
68 bool requestClientCertificate: false, | 68 bool requestClientCertificate: false, |
69 bool requireClientCertificate: false, | 69 bool requireClientCertificate: false, |
70 List<String> supportedProtocols, | 70 List<String> supportedProtocols}) { |
71 bool shared: false}) { | |
72 return RawSecureServerSocket.bind( | 71 return RawSecureServerSocket.bind( |
73 address, | 72 address, |
74 port, | 73 port, |
75 certificateName, | 74 certificateName, |
76 backlog: backlog, | 75 backlog: backlog, |
77 v6Only: v6Only, | 76 v6Only: v6Only, |
78 requestClientCertificate: requestClientCertificate, | 77 requestClientCertificate: requestClientCertificate, |
79 requireClientCertificate: requireClientCertificate, | 78 requireClientCertificate: requireClientCertificate, |
80 supportedProtocols: supportedProtocols, | 79 supportedProtocols: supportedProtocols).then( |
81 shared: shared).then( | |
82 (serverSocket) => new SecureServerSocket._(serverSocket)); | 80 (serverSocket) => new SecureServerSocket._(serverSocket)); |
83 } | 81 } |
84 | 82 |
85 StreamSubscription<SecureSocket> listen(void onData(SecureSocket socket), | 83 StreamSubscription<SecureSocket> listen(void onData(SecureSocket socket), |
86 {Function onError, | 84 {Function onError, |
87 void onDone(), | 85 void onDone(), |
88 bool cancelOnError}) { | 86 bool cancelOnError}) { |
89 return _socket.map((rawSocket) => new SecureSocket._(rawSocket)) | 87 return _socket.map((rawSocket) => new SecureSocket._(rawSocket)) |
90 .listen(onData, | 88 .listen(onData, |
91 onError: onError, | 89 onError: onError, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 * was received, the result will be null. | 185 * was received, the result will be null. |
188 */ | 186 */ |
189 static Future<RawSecureServerSocket> bind( | 187 static Future<RawSecureServerSocket> bind( |
190 address, | 188 address, |
191 int port, | 189 int port, |
192 String certificateName, | 190 String certificateName, |
193 {int backlog: 0, | 191 {int backlog: 0, |
194 bool v6Only: false, | 192 bool v6Only: false, |
195 bool requestClientCertificate: false, | 193 bool requestClientCertificate: false, |
196 bool requireClientCertificate: false, | 194 bool requireClientCertificate: false, |
197 List<String> supportedProtocols, | 195 List<String> supportedProtocols}) { |
198 bool shared: false}) { | 196 return RawServerSocket.bind(address, port, backlog: backlog, v6Only: v6Only) |
199 return RawServerSocket.bind( | |
200 address, port, backlog: backlog, v6Only: v6Only, shared: shared) | |
201 .then((serverSocket) => new RawSecureServerSocket._( | 197 .then((serverSocket) => new RawSecureServerSocket._( |
202 serverSocket, | 198 serverSocket, |
203 certificateName, | 199 certificateName, |
204 requestClientCertificate, | 200 requestClientCertificate, |
205 requireClientCertificate, | 201 requireClientCertificate, |
206 supportedProtocols)); | 202 supportedProtocols)); |
207 } | 203 } |
208 | 204 |
209 StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s), | 205 StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s), |
210 {Function onError, | 206 {Function onError, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 onError: _onError); | 285 onError: _onError); |
290 } else { | 286 } else { |
291 close(); | 287 close(); |
292 } | 288 } |
293 } | 289 } |
294 | 290 |
295 void set _owner(owner) { (_socket as dynamic)._owner = owner; } | 291 void set _owner(owner) { (_socket as dynamic)._owner = owner; } |
296 } | 292 } |
297 | 293 |
298 | 294 |
OLD | NEW |