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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } else { | 246 } else { |
247 _controller.add(secureConnection); | 247 _controller.add(secureConnection); |
248 } | 248 } |
249 }).catchError((e) { | 249 }).catchError((e) { |
250 if (!_closed) { | 250 if (!_closed) { |
251 _controller.addError(e); | 251 _controller.addError(e); |
252 } | 252 } |
253 }); | 253 }); |
254 } | 254 } |
255 | 255 |
256 void _onError(e, [StackTrace stackTrace]) => | 256 void _onError(e, [StackTrace stackTrace]) { |
257 _controller.addError(e, stackTrace); | 257 _controller.addError(e, stackTrace); |
| 258 } |
258 | 259 |
259 void _onDone() => _controller.close(); | 260 void _onDone() { |
| 261 _controller.close(); |
| 262 } |
260 | 263 |
261 void _onPauseStateChange() { | 264 void _onPauseStateChange() { |
262 if (_controller.isPaused) { | 265 if (_controller.isPaused) { |
263 _subscription.pause(); | 266 _subscription.pause(); |
264 } else { | 267 } else { |
265 _subscription.resume(); | 268 _subscription.resume(); |
266 } | 269 } |
267 } | 270 } |
268 | 271 |
269 void _onSubscriptionStateChange() { | 272 void _onSubscriptionStateChange() { |
270 if (_controller.hasListener) { | 273 if (_controller.hasListener) { |
271 _subscription = _socket.listen(_onData, | 274 _subscription = _socket.listen(_onData, |
272 onDone: _onDone, | 275 onDone: _onDone, |
273 onError: _onError); | 276 onError: _onError); |
274 } else { | 277 } else { |
275 close(); | 278 close(); |
276 } | 279 } |
277 } | 280 } |
278 } | 281 } |
279 | 282 |
280 | 283 |
OLD | NEW |