-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use term wireless instead of network #124232
Merged
auto-submit
merged 5 commits into
flutter:master
from
vashworth:wireless_device_discovery_part_7
Apr 19, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e03a1bb
renaming from network to wireless
vashworth 2e29181
move non-overriden message to file used in
vashworth a7953bb
Merge branch 'master' into wireless_device_discovery_part_7
christopherfujino e0cbfae
add back user message used in g3
vashworth bc9015b
Merge branch 'master' into wireless_device_discovery_part_7
vashworth File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,7 @@ class MDnsVmServiceDiscovery { | |
/// The [deviceVmservicePort] parameter may be used to specify which port | ||
/// to find. | ||
/// | ||
/// The [isNetworkDevice] parameter flags whether to get the device IP | ||
/// The [useDeviceIPAsHost] parameter flags whether to get the device IP | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I read this as |
||
/// and the [ipv6] parameter flags whether to get an iPv6 address | ||
/// (otherwise it will get iPv4). | ||
/// | ||
|
@@ -80,7 +80,7 @@ class MDnsVmServiceDiscovery { | |
String? applicationId, | ||
int? deviceVmservicePort, | ||
bool ipv6 = false, | ||
bool isNetworkDevice = false, | ||
bool useDeviceIPAsHost = false, | ||
Duration timeout = const Duration(minutes: 10), | ||
}) async { | ||
// Poll for 5 seconds to see if there are already services running. | ||
|
@@ -93,7 +93,7 @@ class MDnsVmServiceDiscovery { | |
applicationId: applicationId, | ||
deviceVmservicePort: deviceVmservicePort, | ||
ipv6: ipv6, | ||
isNetworkDevice: isNetworkDevice, | ||
useDeviceIPAsHost: useDeviceIPAsHost, | ||
timeout: const Duration(seconds: 5), | ||
); | ||
if (results.isEmpty) { | ||
|
@@ -102,7 +102,7 @@ class MDnsVmServiceDiscovery { | |
applicationId: applicationId, | ||
deviceVmservicePort: deviceVmservicePort, | ||
ipv6: ipv6, | ||
isNetworkDevice: isNetworkDevice, | ||
useDeviceIPAsHost: useDeviceIPAsHost, | ||
timeout: timeout, | ||
); | ||
} else if (results.length > 1) { | ||
|
@@ -134,7 +134,7 @@ class MDnsVmServiceDiscovery { | |
/// if multiple flutter apps are running on different devices, it will | ||
/// only match with the device running the desired app. | ||
/// | ||
/// The [isNetworkDevice] parameter flags whether to get the device IP | ||
/// The [useDeviceIPAsHost] parameter flags whether to get the device IP | ||
/// and the [ipv6] parameter flags whether to get an iPv6 address | ||
/// (otherwise it will get iPv4). | ||
/// | ||
|
@@ -148,7 +148,7 @@ class MDnsVmServiceDiscovery { | |
required String applicationId, | ||
required int deviceVmservicePort, | ||
bool ipv6 = false, | ||
bool isNetworkDevice = false, | ||
bool useDeviceIPAsHost = false, | ||
Duration timeout = const Duration(minutes: 10), | ||
}) async { | ||
// Query for a specific application and device port. | ||
|
@@ -157,7 +157,7 @@ class MDnsVmServiceDiscovery { | |
applicationId: applicationId, | ||
deviceVmservicePort: deviceVmservicePort, | ||
ipv6: ipv6, | ||
isNetworkDevice: isNetworkDevice, | ||
useDeviceIPAsHost: useDeviceIPAsHost, | ||
timeout: timeout, | ||
); | ||
} | ||
|
@@ -171,15 +171,15 @@ class MDnsVmServiceDiscovery { | |
String? applicationId, | ||
int? deviceVmservicePort, | ||
bool ipv6 = false, | ||
bool isNetworkDevice = false, | ||
bool useDeviceIPAsHost = false, | ||
Duration timeout = const Duration(minutes: 10), | ||
}) async { | ||
final List<MDnsVmServiceDiscoveryResult> results = await _pollingVmService( | ||
client, | ||
applicationId: applicationId, | ||
deviceVmservicePort: deviceVmservicePort, | ||
ipv6: ipv6, | ||
isNetworkDevice: isNetworkDevice, | ||
useDeviceIPAsHost: useDeviceIPAsHost, | ||
timeout: timeout, | ||
quitOnFind: true, | ||
); | ||
|
@@ -194,7 +194,7 @@ class MDnsVmServiceDiscovery { | |
String? applicationId, | ||
int? deviceVmservicePort, | ||
bool ipv6 = false, | ||
bool isNetworkDevice = false, | ||
bool useDeviceIPAsHost = false, | ||
required Duration timeout, | ||
bool quitOnFind = false, | ||
}) async { | ||
|
@@ -263,9 +263,9 @@ class MDnsVmServiceDiscovery { | |
continue; | ||
} | ||
|
||
// Get the IP address of the service if using a network device. | ||
// Get the IP address of the device if using the IP as the host. | ||
InternetAddress? ipAddress; | ||
if (isNetworkDevice) { | ||
if (useDeviceIPAsHost) { | ||
List<IPAddressResourceRecord> ipAddresses = await client | ||
.lookup<IPAddressResourceRecord>( | ||
ipv6 | ||
|
@@ -351,6 +351,9 @@ class MDnsVmServiceDiscovery { | |
/// Gets Dart VM Service Uri for `flutter attach`. | ||
/// Executes an mDNS query and waits until a Dart VM Service is found. | ||
/// | ||
/// When [useDeviceIPAsHost] is true, it will use the device's IP as the | ||
/// host and will not forward the port. | ||
/// | ||
/// Differs from `getVMServiceUriForLaunch` because it can search for any available Dart VM Service. | ||
/// Since [applicationId] and [deviceVmservicePort] are optional, it can either look for any service | ||
/// or a specific service matching [applicationId]/[deviceVmservicePort]. | ||
|
@@ -361,14 +364,14 @@ class MDnsVmServiceDiscovery { | |
bool usesIpv6 = false, | ||
int? hostVmservicePort, | ||
int? deviceVmservicePort, | ||
bool isNetworkDevice = false, | ||
bool useDeviceIPAsHost = false, | ||
Duration timeout = const Duration(minutes: 10), | ||
}) async { | ||
final MDnsVmServiceDiscoveryResult? result = await queryForAttach( | ||
applicationId: applicationId, | ||
deviceVmservicePort: deviceVmservicePort, | ||
ipv6: usesIpv6, | ||
isNetworkDevice: isNetworkDevice, | ||
useDeviceIPAsHost: useDeviceIPAsHost, | ||
timeout: timeout, | ||
); | ||
return _handleResult( | ||
|
@@ -378,13 +381,16 @@ class MDnsVmServiceDiscovery { | |
deviceVmservicePort: deviceVmservicePort, | ||
hostVmservicePort: hostVmservicePort, | ||
usesIpv6: usesIpv6, | ||
isNetworkDevice: isNetworkDevice | ||
useDeviceIPAsHost: useDeviceIPAsHost | ||
); | ||
} | ||
|
||
/// Gets Dart VM Service Uri for `flutter run`. | ||
/// Executes an mDNS query and waits until the Dart VM Service service is found. | ||
/// | ||
/// When [useDeviceIPAsHost] is true, it will use the device's IP as the | ||
/// host and will not forward the port. | ||
/// | ||
/// Differs from `getVMServiceUriForAttach` because it only searches for a specific service. | ||
/// This is enforced by [applicationId] and [deviceVmservicePort] being required. | ||
Future<Uri?> getVMServiceUriForLaunch( | ||
|
@@ -393,14 +399,14 @@ class MDnsVmServiceDiscovery { | |
bool usesIpv6 = false, | ||
int? hostVmservicePort, | ||
required int deviceVmservicePort, | ||
bool isNetworkDevice = false, | ||
bool useDeviceIPAsHost = false, | ||
Duration timeout = const Duration(minutes: 10), | ||
}) async { | ||
final MDnsVmServiceDiscoveryResult? result = await queryForLaunch( | ||
applicationId: applicationId, | ||
deviceVmservicePort: deviceVmservicePort, | ||
ipv6: usesIpv6, | ||
isNetworkDevice: isNetworkDevice, | ||
useDeviceIPAsHost: useDeviceIPAsHost, | ||
timeout: timeout, | ||
); | ||
return _handleResult( | ||
|
@@ -410,7 +416,7 @@ class MDnsVmServiceDiscovery { | |
deviceVmservicePort: deviceVmservicePort, | ||
hostVmservicePort: hostVmservicePort, | ||
usesIpv6: usesIpv6, | ||
isNetworkDevice: isNetworkDevice | ||
useDeviceIPAsHost: useDeviceIPAsHost | ||
); | ||
} | ||
|
||
|
@@ -421,7 +427,7 @@ class MDnsVmServiceDiscovery { | |
int? deviceVmservicePort, | ||
int? hostVmservicePort, | ||
bool usesIpv6 = false, | ||
bool isNetworkDevice = false, | ||
bool useDeviceIPAsHost = false, | ||
}) async { | ||
if (result == null) { | ||
await _checkForIPv4LinkLocal(device); | ||
|
@@ -430,7 +436,7 @@ class MDnsVmServiceDiscovery { | |
final String host; | ||
|
||
final InternetAddress? ipAddress = result.ipAddress; | ||
if (isNetworkDevice && ipAddress != null) { | ||
if (useDeviceIPAsHost && ipAddress != null) { | ||
host = ipAddress.address; | ||
} else { | ||
host = usesIpv6 | ||
|
@@ -443,7 +449,7 @@ class MDnsVmServiceDiscovery { | |
result.port, | ||
hostVmservicePort, | ||
result.authCode, | ||
isNetworkDevice, | ||
useDeviceIPAsHost, | ||
); | ||
} | ||
|
||
|
@@ -529,7 +535,7 @@ Future<Uri> buildVMServiceUri( | |
int devicePort, [ | ||
int? hostVmservicePort, | ||
String? authCode, | ||
bool isNetworkDevice = false, | ||
bool useDeviceIPAsHost = false, | ||
]) async { | ||
String path = '/'; | ||
if (authCode != null) { | ||
|
@@ -543,8 +549,8 @@ Future<Uri> buildVMServiceUri( | |
hostVmservicePort ??= 0; | ||
|
||
final int? actualHostPort; | ||
if (isNetworkDevice) { | ||
// When debugging with a network device, port forwarding is not required | ||
if (useDeviceIPAsHost) { | ||
// When using the device's IP as the host, port forwarding is not required | ||
// so just use the device's port. | ||
actualHostPort = devicePort; | ||
} else { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved messages as per this comment from original PR: https://github.com/flutter/flutter/pull/121262/files#r1115130107