Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d73dd6b3
Unverified
Commit
d73dd6b3
authored
Feb 25, 2020
by
Zachary Anderson
Committed by
GitHub
Feb 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Rework iOS vmservice handshake failure usage event (#51419)
parent
1ec2a436
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
fallback_discovery.dart
packages/flutter_tools/lib/src/ios/fallback_discovery.dart
+22
-11
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/ios/fallback_discovery.dart
View file @
d73dd6b3
...
...
@@ -6,6 +6,7 @@ import 'package:meta/meta.dart';
import
'package:vm_service/vm_service.dart'
;
import
'package:vm_service/vm_service_io.dart'
as
vm_service_io
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../device.dart'
;
import
'../mdns_discovery.dart'
;
...
...
@@ -120,19 +121,14 @@ class FallbackDiscovery {
}
on
Exception
catch
(
err
)
{
_logger
.
printTrace
(
err
.
toString
());
_logger
.
printTrace
(
'Failed to connect directly, falling back to mDNS'
);
UsageEvent
(
_kEventName
,
'failure'
,
label:
err
.
toString
(),
value:
hostPort
,
).
send
();
_sendFailureEvent
(
err
,
assumedDevicePort
);
return
null
;
}
// Attempt to connect to the VM service 5 times.
int
attempts
=
0
;
const
int
kDelaySeconds
=
2
;
Object
firstException
;
Exception
firstException
;
while
(
attempts
<
5
)
{
try
{
final
VmService
vmService
=
await
_vmServiceConnectUri
(
assumedWsUri
.
toString
());
...
...
@@ -163,12 +159,27 @@ class FallbackDiscovery {
attempts
+=
1
;
}
_logger
.
printTrace
(
'Failed to connect directly, falling back to mDNS'
);
_sendFailureEvent
(
firstException
,
assumedDevicePort
);
return
null
;
}
void
_sendFailureEvent
(
Exception
err
,
int
assumedDevicePort
)
{
String
eventAction
;
String
eventLabel
;
if
(
err
==
null
)
{
eventAction
=
'failure-attempts-exhausted'
;
eventLabel
=
assumedDevicePort
.
toString
();
}
else
if
(
err
is
HttpException
)
{
eventAction
=
'failure-http'
;
eventLabel
=
'
${err.message}
, device port =
$assumedDevicePort
'
;
}
else
{
eventAction
=
'failure-other'
;
eventLabel
=
'
$err
, device port =
$assumedDevicePort
'
;
}
UsageEvent
(
_kEventName
,
'failure'
,
label:
firstException
?.
toString
()
??
'Connection attempts exhausted'
,
value:
hostPort
,
eventAction
,
label:
eventLabel
,
).
send
();
return
null
;
}
}
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
d73dd6b3
...
...
@@ -643,7 +643,7 @@ void main() {
expect
(
launchResult
.
hasObservatory
,
isFalse
);
verify
(
mockUsage
.
sendEvent
(
'ios-handshake'
,
'failure'
,
'failure
-other
'
,
label:
anyNamed
(
'label'
),
value:
anyNamed
(
'value'
),
)).
called
(
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment