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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 .then((RawSecureSocket secureConnection) { | 191 .then((RawSecureSocket secureConnection) { |
192 if (_closed) { | 192 if (_closed) { |
193 secureConnection.close(); | 193 secureConnection.close(); |
194 } else { | 194 } else { |
195 _controller.add(secureConnection); | 195 _controller.add(secureConnection); |
196 } | 196 } |
197 }).catchError((e) { | 197 }).catchError((e) { |
198 if (_closed) { | 198 if (_closed) { |
199 throw e; | 199 throw e; |
200 } else { | 200 } else { |
201 _controller.signalError(e); | 201 _controller.addError(e); |
202 close(); | 202 close(); |
203 } | 203 } |
204 }); | 204 }); |
205 } | 205 } |
206 | 206 |
207 void _onError(e) { | 207 void _onError(e) { |
208 _controller.signalError(e); | 208 _controller.addError(e); |
209 close(); | 209 close(); |
210 } | 210 } |
211 | 211 |
212 void _onDone() { | 212 void _onDone() { |
213 _controller.close(); | 213 _controller.close(); |
214 } | 214 } |
215 | 215 |
216 void _onPauseStateChange() { | 216 void _onPauseStateChange() { |
217 if (_controller.isPaused) { | 217 if (_controller.isPaused) { |
218 _subscription.pause(); | 218 _subscription.pause(); |
219 } else { | 219 } else { |
220 _subscription.resume(); | 220 _subscription.resume(); |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 void _onSubscriptionStateChange() { | 224 void _onSubscriptionStateChange() { |
225 if (_controller.hasSubscribers) { | 225 if (_controller.hasSubscribers) { |
226 _subscription = _socket.listen(_onData, | 226 _subscription = _socket.listen(_onData, |
227 onDone: _onDone, | 227 onDone: _onDone, |
228 onError: _onError); | 228 onError: _onError); |
229 } else { | 229 } else { |
230 close(); | 230 close(); |
231 } | 231 } |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 | 235 |
OLD | NEW |