Revert "[ package:dds ] Add IPv6 support; 1.3.2 release"
This reverts commit 23f80fb7fdb231375834d145371cdc2165752433.
Reason for revert: https://github.com/dart-lang/sdk/issues/43292
Original change's description:
> [ package:dds ] Add IPv6 support; 1.3.2 release
>
> Change-Id: I62ca85c2340d8c91fd2f08c945bf981ac36adad3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161400
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>
TBR=bkonyi@google.com,rmacnak@google.com
Change-Id: I30f1485ef573d5f2f9c7bebcfc3ef800e344fac1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161450
Reviewed-by: Ben Konyi <bkonyi@google.com>
diff --git a/pkg/dds/CHANGELOG.md b/pkg/dds/CHANGELOG.md
index 96848ba..52b7282 100644
--- a/pkg/dds/CHANGELOG.md
+++ b/pkg/dds/CHANGELOG.md
@@ -1,6 +1,5 @@
-# 1.3.2
+# 1.3.2-dev
-- Add IPv6 hosting support.
- Fix handling of requests that are outstanding when a client channel is closed.
# 1.3.1
diff --git a/pkg/dds/lib/dds.dart b/pkg/dds/lib/dds.dart
index 5827301..f9c057c 100644
--- a/pkg/dds/lib/dds.dart
+++ b/pkg/dds/lib/dds.dart
@@ -51,8 +51,7 @@
/// development service will communicate with.
///
/// If provided, [serviceUri] will determine the address and port of the
- /// spawned Dart Development Service. The format of [serviceUri] must be
- /// consistent with the protocol determined by [ipv6].
+ /// spawned Dart Development Service.
///
/// [enableAuthCodes] controls whether or not an authentication code must
/// be provided by clients when communicating with this instance of
@@ -60,14 +59,10 @@
/// encoded string provided as the first element of the DDS path and is meant
/// to make it more difficult for unintended clients to connect to this
/// service. Authentication codes are enabled by default.
- ///
- /// [ipv6] controls whether or not DDS is served via IPv6. IPv4 is enabled by
- /// default.
static Future<DartDevelopmentService> startDartDevelopmentService(
Uri remoteVmServiceUri, {
Uri serviceUri,
bool enableAuthCodes = true,
- bool ipv6 = false,
}) async {
if (remoteVmServiceUri == null) {
throw ArgumentError.notNull('remoteVmServiceUri');
@@ -77,29 +72,15 @@
'remoteVmServiceUri must have an HTTP scheme. Actual: ${remoteVmServiceUri.scheme}',
);
}
- if (serviceUri != null) {
- if (serviceUri.scheme != 'http') {
- throw ArgumentError(
- 'serviceUri must have an HTTP scheme. Actual: ${serviceUri.scheme}',
- );
- }
-
- // If provided an address to bind to, ensure it uses a protocol consistent
- // with that used to spawn DDS.
- final address = (await InternetAddress.lookup(serviceUri.host)).first;
- if ((ipv6 && address.type != InternetAddressType.IPv6) ||
- (!ipv6 && address.type != InternetAddressType.IPv4)) {
- throw ArgumentError(
- "serviceUri '$serviceUri' is not an IPv${ipv6 ? "6" : "4"} address.",
- );
- }
+ if (serviceUri != null && serviceUri.scheme != 'http') {
+ throw ArgumentError(
+ 'serviceUri must have an HTTP scheme. Actual: ${serviceUri.scheme}',
+ );
}
-
final service = _DartDevelopmentService(
remoteVmServiceUri,
serviceUri,
enableAuthCodes,
- ipv6,
);
await service.startService();
return service;
diff --git a/pkg/dds/lib/src/dds_impl.dart b/pkg/dds/lib/src/dds_impl.dart
index 192e9ad5..55e9e64 100644
--- a/pkg/dds/lib/src/dds_impl.dart
+++ b/pkg/dds/lib/src/dds_impl.dart
@@ -6,7 +6,10 @@
class _DartDevelopmentService implements DartDevelopmentService {
_DartDevelopmentService(
- this._remoteVmServiceUri, this._uri, this._authCodesEnabled, this._ipv6) {
+ this._remoteVmServiceUri,
+ this._uri,
+ this._authCodesEnabled,
+ ) {
_clientManager = _ClientManager(this);
_expressionEvaluator = _ExpressionEvaluator(this);
_isolateManager = _IsolateManager(this);
@@ -35,9 +38,8 @@
Future<void> _startDDSServer() async {
// No provided address, bind to an available port on localhost.
- final host = uri?.host ??
- (_ipv6 ? InternetAddress.loopbackIPv6 : InternetAddress.loopbackIPv4)
- .host;
+ // TODO(bkonyi): handle case where there's no IPv4 loopback.
+ final host = uri?.host ?? InternetAddress.loopbackIPv4.host;
final port = uri?.port ?? 0;
// Start the DDS server.
@@ -224,8 +226,6 @@
Uri get wsUri => _toWebSocket(_uri);
Uri _uri;
- final bool _ipv6;
-
bool get isRunning => _uri != null;
Future<void> get done => _done.future;
diff --git a/pkg/dds/pubspec.yaml b/pkg/dds/pubspec.yaml
index 447170c..e1d0d3d 100644
--- a/pkg/dds/pubspec.yaml
+++ b/pkg/dds/pubspec.yaml
@@ -3,7 +3,7 @@
A library used to spawn the Dart Developer Service, used to communicate with
a Dart VM Service instance.
-version: 1.3.2
+version: 1.3.2-dev
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/dds
diff --git a/pkg/dds/test/smoke_test.dart b/pkg/dds/test/smoke_test.dart
index d7b16b1..e7e5216 100644
--- a/pkg/dds/test/smoke_test.dart
+++ b/pkg/dds/test/smoke_test.dart
@@ -27,26 +27,16 @@
process = null;
});
- void createSmokeTest(bool useAuthCodes, bool ipv6) {
- final protocol = ipv6 ? 'IPv6' : 'IPv4';
+ void createSmokeTest(bool useAuthCodes) {
test(
- 'Smoke Test with ${useAuthCodes ? "" : "no"} authentication codes '
- 'with $protocol',
+ 'Smoke Test with ${useAuthCodes ? "" : "no "} authentication codes',
() async {
dds = await DartDevelopmentService.startDartDevelopmentService(
remoteVmServiceUri,
enableAuthCodes: useAuthCodes,
- ipv6: ipv6,
);
expect(dds.isRunning, true);
- try {
- Uri.parseIPv6Address(dds.uri.host);
- expect(ipv6, true);
- } on FormatException {
- expect(ipv6, false);
- }
-
// Ensure basic websocket requests are forwarded correctly to the VM service.
final service = await vmServiceConnectUri(dds.wsUri.toString());
final version = await service.getVersion();
@@ -79,9 +69,8 @@
);
}
- createSmokeTest(true, false);
- createSmokeTest(false, false);
- createSmokeTest(true, true);
+ createSmokeTest(true);
+ createSmokeTest(false);
test('startup fails when VM service has existing clients', () async {
Uri httpToWebSocketUri(Uri httpUri) {
@@ -132,23 +121,5 @@
serviceUri: Uri.parse('dart-lang://localhost:2345'),
),
throwsA(TypeMatcher<ArgumentError>()));
-
- // Protocol mismatch
- expect(
- () async => await DartDevelopmentService.startDartDevelopmentService(
- Uri.parse('http://localhost:1234'),
- serviceUri: Uri.parse('http://127.0.0.1:2345'),
- ipv6: true,
- ),
- throwsA(TypeMatcher<ArgumentError>()));
-
- // Protocol mismatch
- expect(
- () async => await DartDevelopmentService.startDartDevelopmentService(
- Uri.parse('http://localhost:1234'),
- serviceUri: Uri.parse('http://[::1]:2345'),
- ipv6: false,
- ),
- throwsA(TypeMatcher<ArgumentError>()));
});
}