Skip to content

Commit 7a9adfd

Browse files
authored
Send an event when proxied DDS creates a connection. (#139530)
The event allows tools to listen and connect to the original DDS port.
1 parent c396011 commit 7a9adfd

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎packages/flutter_tools/lib/src/proxied_devices/devices.dart‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,11 @@ class ProxiedDartDevelopmentService implements DartDevelopmentService {
775775

776776
_localUri = remoteUri.replace(port: localPort);
777777
_logger.printTrace('Local port forwarded DDS on $_localUri.');
778+
_logger.sendEvent('device.proxied_dds_forwarded', <String, String>{
779+
'deviceId': deviceId,
780+
'remoteUri': remoteUri.toString(),
781+
'localUri': _localUri!.toString(),
782+
});
778783
}
779784

780785
@override

‎packages/flutter_tools/test/general.shard/proxied_devices/proxied_devices_test.dart‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,11 @@ void main() {
440440

441441
expect(dds.uri, Uri.parse('http://127.0.0.1:400/remote'));
442442

443+
expect(
444+
bufferLogger.eventText.trim(),
445+
'{"name":"device.proxied_dds_forwarded","args":{"deviceId":"test_id","remoteUri":"http://127.0.0.1:300/remote","localUri":"http://127.0.0.1:400/remote"}}',
446+
);
447+
443448
unawaited(dds.shutdown());
444449

445450
final DaemonMessage shutdownMessage = await broadcastOutput.first;

0 commit comments

Comments
 (0)