OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library http_multi_server.utils; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 import 'dart:io'; | 6 import 'dart:io'; |
9 | 7 |
10 /// Merges all streams in [streams] into a single stream that emits all of their | 8 /// Merges all streams in [streams] into a single stream that emits all of their |
11 /// values. | 9 /// values. |
12 /// | 10 /// |
13 /// The returned stream will be closed only when every stream in [streams] is | 11 /// The returned stream will be closed only when every stream in [streams] is |
14 /// closed. | 12 /// closed. |
15 Stream mergeStreams(Iterable<Stream> streams) { | 13 Stream mergeStreams(Iterable<Stream> streams) { |
16 var subscriptions = new Set(); | 14 var subscriptions = new Set(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0).then((socket) { | 51 return ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0).then((socket) { |
54 _supportsIpV6 = true; | 52 _supportsIpV6 = true; |
55 socket.close(); | 53 socket.close(); |
56 return true; | 54 return true; |
57 }).catchError((error) { | 55 }).catchError((error) { |
58 if (error is! SocketException) throw error; | 56 if (error is! SocketException) throw error; |
59 _supportsIpV6 = false; | 57 _supportsIpV6 = false; |
60 return false; | 58 return false; |
61 }); | 59 }); |
62 } | 60 } |
OLD | NEW |