Fix race condition in protocol_discovery.dart (#10092)
For some reaosn, when we discovered our URI, we were re-instantiating the `Completer` instance variable whose future we listen to in `nextUri()`. This led to a race between a caller calling `nextUri()` and us discovering the URI. If we happened to discover our URI before a caller called `nextUri()`, then they would be left waiting on a future from the newly allocated `Completer` (which would never complete). Fixes #10064
This commit is contained in:
@@ -407,12 +407,12 @@ class AndroidDevice extends Device {
|
||||
|
||||
if (debuggingOptions.buildMode == BuildMode.debug) {
|
||||
final List<Uri> deviceUris = await Future.wait(
|
||||
<Future<Uri>>[observatoryDiscovery.nextUri(), diagnosticDiscovery.nextUri()]
|
||||
<Future<Uri>>[observatoryDiscovery.uri, diagnosticDiscovery.uri]
|
||||
);
|
||||
observatoryUri = deviceUris[0];
|
||||
diagnosticUri = deviceUris[1];
|
||||
} else if (debuggingOptions.buildMode == BuildMode.profile) {
|
||||
observatoryUri = await observatoryDiscovery.nextUri();
|
||||
observatoryUri = await observatoryDiscovery.uri;
|
||||
}
|
||||
|
||||
return new LaunchResult.succeeded(
|
||||
|
||||
Reference in New Issue
Block a user