Unverified Commit 3e6863ab authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

Revert "Ensure VmService instance is disposed after failed direct connection...

Revert "Ensure VmService instance is disposed after failed direct connection attempt (#66123)" (#66164)

This reverts commit 409e994c.
Co-authored-by: 's avatarJenn Magder <magder@google.com>
parent 5c858036
...@@ -156,10 +156,9 @@ class FallbackDiscovery { ...@@ -156,10 +156,9 @@ class FallbackDiscovery {
// Attempt to connect to the VM service 5 times. // Attempt to connect to the VM service 5 times.
int attempts = 0; int attempts = 0;
Exception firstException; Exception firstException;
VmService vmService;
while (attempts < 5) { while (attempts < 5) {
try { try {
vmService = await _vmServiceConnectUri( final VmService vmService = await _vmServiceConnectUri(
assumedWsUri.toString(), assumedWsUri.toString(),
); );
final VM vm = await vmService.getVM(); final VM vm = await vmService.getVM();
...@@ -168,17 +167,15 @@ class FallbackDiscovery { ...@@ -168,17 +167,15 @@ class FallbackDiscovery {
isolateRefs.id, isolateRefs.id,
); );
final LibraryRef library = isolateResponse.rootLib; final LibraryRef library = isolateResponse.rootLib;
if (library != null && if (library != null && library.uri.startsWith('package:$packageName')) {
(library.uri.startsWith('package:$packageName') ||
library.uri.startsWith(RegExp(r'file:\/\/\/.*\/' + packageName)))) {
UsageEvent( UsageEvent(
_kEventName, _kEventName,
'success', 'success',
flutterUsage: _flutterUsage, flutterUsage: _flutterUsage,
).send(); ).send();
// This vmService instance must be disposed of, otherwise DDS will // We absolutely must dispose this vmService instance, otherwise
// fail to start. // DDS will fail to start.
vmService.dispose(); vmService.dispose();
return Uri.parse('http://localhost:$hostPort'); return Uri.parse('http://localhost:$hostPort');
} }
...@@ -187,10 +184,6 @@ class FallbackDiscovery { ...@@ -187,10 +184,6 @@ class FallbackDiscovery {
// No action, we might have failed to connect. // No action, we might have failed to connect.
firstException ??= err; firstException ??= err;
_logger.printTrace(err.toString()); _logger.printTrace(err.toString());
} finally {
// This vmService instance must be disposed of, otherwise DDS will
// fail to start.
vmService?.dispose();
} }
// No exponential backoff is used here to keep the amount of time the // No exponential backoff is used here to keep the amount of time the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment