OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
9 import 'package:pub_semver/pub_semver.dart'; | 9 import 'package:pub_semver/pub_semver.dart'; |
10 import 'package:shelf/shelf.dart' as shelf; | |
jakemac
2016/08/09 20:12:24
Not sure why this is necessary?
nweiz
2016/08/09 22:01:34
Oops, this was left over from a different change.
| |
10 | 11 |
11 import '../backend/operating_system.dart'; | 12 import '../backend/operating_system.dart'; |
12 import '../util/stream_queue.dart'; | 13 import '../util/stream_queue.dart'; |
13 import '../utils.dart'; | 14 import '../utils.dart'; |
14 | 15 |
15 /// The ASCII code for a newline character. | 16 /// The ASCII code for a newline character. |
16 const _newline = 0xA; | 17 const _newline = 0xA; |
17 | 18 |
18 /// The ASCII code for a carriage return character. | 19 /// The ASCII code for a carriage return character. |
19 const _carriageReturn = 0xD; | 20 const _carriageReturn = 0xD; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 /// | 138 /// |
138 /// This has a built-in race condition: another process may bind this port at | 139 /// This has a built-in race condition: another process may bind this port at |
139 /// any time after this call has returned. If at all possible, callers should | 140 /// any time after this call has returned. If at all possible, callers should |
140 /// use [getUnusedPort] instead. | 141 /// use [getUnusedPort] instead. |
141 Future<int> getUnsafeUnusedPort() async { | 142 Future<int> getUnsafeUnusedPort() async { |
142 var socket = await RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0); | 143 var socket = await RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0); |
143 var port = socket.port; | 144 var port = socket.port; |
144 await socket.close(); | 145 await socket.close(); |
145 return port; | 146 return port; |
146 } | 147 } |
OLD | NEW |