Skip to content

Commit c9182ad

Browse files
committed
Revert "[ package:dds ] Add IPv6 support; 1.3.2 release"
This reverts commit 23f80fb. Reason for revert: #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>
1 parent c781fa4 commit c9182ad

File tree

5 files changed

+17
-66
lines changed

5 files changed

+17
-66
lines changed

pkg/dds/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# 1.3.2
1+
# 1.3.2-dev
22

3-
- Add IPv6 hosting support.
43
- Fix handling of requests that are outstanding when a client channel is closed.
54

65
# 1.3.1

pkg/dds/lib/dds.dart

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,18 @@ abstract class DartDevelopmentService {
5151
/// development service will communicate with.
5252
///
5353
/// If provided, [serviceUri] will determine the address and port of the
54-
/// spawned Dart Development Service. The format of [serviceUri] must be
55-
/// consistent with the protocol determined by [ipv6].
54+
/// spawned Dart Development Service.
5655
///
5756
/// [enableAuthCodes] controls whether or not an authentication code must
5857
/// be provided by clients when communicating with this instance of
5958
/// [DartDevelopmentService]. Authentication codes take the form of a base64
6059
/// encoded string provided as the first element of the DDS path and is meant
6160
/// to make it more difficult for unintended clients to connect to this
6261
/// service. Authentication codes are enabled by default.
63-
///
64-
/// [ipv6] controls whether or not DDS is served via IPv6. IPv4 is enabled by
65-
/// default.
6662
static Future<DartDevelopmentService> startDartDevelopmentService(
6763
Uri remoteVmServiceUri, {
6864
Uri serviceUri,
6965
bool enableAuthCodes = true,
70-
bool ipv6 = false,
7166
}) async {
7267
if (remoteVmServiceUri == null) {
7368
throw ArgumentError.notNull('remoteVmServiceUri');
@@ -77,29 +72,15 @@ abstract class DartDevelopmentService {
7772
'remoteVmServiceUri must have an HTTP scheme. Actual: ${remoteVmServiceUri.scheme}',
7873
);
7974
}
80-
if (serviceUri != null) {
81-
if (serviceUri.scheme != 'http') {
82-
throw ArgumentError(
83-
'serviceUri must have an HTTP scheme. Actual: ${serviceUri.scheme}',
84-
);
85-
}
86-
87-
// If provided an address to bind to, ensure it uses a protocol consistent
88-
// with that used to spawn DDS.
89-
final address = (await InternetAddress.lookup(serviceUri.host)).first;
90-
if ((ipv6 && address.type != InternetAddressType.IPv6) ||
91-
(!ipv6 && address.type != InternetAddressType.IPv4)) {
92-
throw ArgumentError(
93-
"serviceUri '$serviceUri' is not an IPv${ipv6 ? "6" : "4"} address.",
94-
);
95-
}
75+
if (serviceUri != null && serviceUri.scheme != 'http') {
76+
throw ArgumentError(
77+
'serviceUri must have an HTTP scheme. Actual: ${serviceUri.scheme}',
78+
);
9679
}
97-
9880
final service = _DartDevelopmentService(
9981
remoteVmServiceUri,
10082
serviceUri,
10183
enableAuthCodes,
102-
ipv6,
10384
);
10485
await service.startService();
10586
return service;

pkg/dds/lib/src/dds_impl.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ part of dds;
66

77
class _DartDevelopmentService implements DartDevelopmentService {
88
_DartDevelopmentService(
9-
this._remoteVmServiceUri, this._uri, this._authCodesEnabled, this._ipv6) {
9+
this._remoteVmServiceUri,
10+
this._uri,
11+
this._authCodesEnabled,
12+
) {
1013
_clientManager = _ClientManager(this);
1114
_expressionEvaluator = _ExpressionEvaluator(this);
1215
_isolateManager = _IsolateManager(this);
@@ -35,9 +38,8 @@ class _DartDevelopmentService implements DartDevelopmentService {
3538

3639
Future<void> _startDDSServer() async {
3740
// No provided address, bind to an available port on localhost.
38-
final host = uri?.host ??
39-
(_ipv6 ? InternetAddress.loopbackIPv6 : InternetAddress.loopbackIPv4)
40-
.host;
41+
// TODO(bkonyi): handle case where there's no IPv4 loopback.
42+
final host = uri?.host ?? InternetAddress.loopbackIPv4.host;
4143
final port = uri?.port ?? 0;
4244

4345
// Start the DDS server.
@@ -224,8 +226,6 @@ class _DartDevelopmentService implements DartDevelopmentService {
224226
Uri get wsUri => _toWebSocket(_uri);
225227
Uri _uri;
226228

227-
final bool _ipv6;
228-
229229
bool get isRunning => _uri != null;
230230

231231
Future<void> get done => _done.future;

pkg/dds/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: >-
33
A library used to spawn the Dart Developer Service, used to communicate with
44
a Dart VM Service instance.
55
6-
version: 1.3.2
6+
version: 1.3.2-dev
77

88
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/dds
99

pkg/dds/test/smoke_test.dart

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,16 @@ void main() {
2727
process = null;
2828
});
2929

30-
void createSmokeTest(bool useAuthCodes, bool ipv6) {
31-
final protocol = ipv6 ? 'IPv6' : 'IPv4';
30+
void createSmokeTest(bool useAuthCodes) {
3231
test(
33-
'Smoke Test with ${useAuthCodes ? "" : "no"} authentication codes '
34-
'with $protocol',
32+
'Smoke Test with ${useAuthCodes ? "" : "no "} authentication codes',
3533
() async {
3634
dds = await DartDevelopmentService.startDartDevelopmentService(
3735
remoteVmServiceUri,
3836
enableAuthCodes: useAuthCodes,
39-
ipv6: ipv6,
4037
);
4138
expect(dds.isRunning, true);
4239

43-
try {
44-
Uri.parseIPv6Address(dds.uri.host);
45-
expect(ipv6, true);
46-
} on FormatException {
47-
expect(ipv6, false);
48-
}
49-
5040
// Ensure basic websocket requests are forwarded correctly to the VM service.
5141
final service = await vmServiceConnectUri(dds.wsUri.toString());
5242
final version = await service.getVersion();
@@ -79,9 +69,8 @@ void main() {
7969
);
8070
}
8171

82-
createSmokeTest(true, false);
83-
createSmokeTest(false, false);
84-
createSmokeTest(true, true);
72+
createSmokeTest(true);
73+
createSmokeTest(false);
8574

8675
test('startup fails when VM service has existing clients', () async {
8776
Uri httpToWebSocketUri(Uri httpUri) {
@@ -132,23 +121,5 @@ void main() {
132121
serviceUri: Uri.parse('dart-lang://localhost:2345'),
133122
),
134123
throwsA(TypeMatcher<ArgumentError>()));
135-
136-
// Protocol mismatch
137-
expect(
138-
() async => await DartDevelopmentService.startDartDevelopmentService(
139-
Uri.parse('http://localhost:1234'),
140-
serviceUri: Uri.parse('http://127.0.0.1:2345'),
141-
ipv6: true,
142-
),
143-
throwsA(TypeMatcher<ArgumentError>()));
144-
145-
// Protocol mismatch
146-
expect(
147-
() async => await DartDevelopmentService.startDartDevelopmentService(
148-
Uri.parse('http://localhost:1234'),
149-
serviceUri: Uri.parse('http://[::1]:2345'),
150-
ipv6: false,
151-
),
152-
throwsA(TypeMatcher<ArgumentError>()));
153124
});
154125
}

0 commit comments

Comments
 (0)