Send an event when proxied DDS creates a connection. (#139530)

The event allows tools to listen and connect to the original DDS port.
This commit is contained in:
Lau Ching Jun 2023-12-05 00:32:25 -08:00 committed by GitHub
parent c396011e7e
commit 7a9adfd1c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -775,6 +775,11 @@ class ProxiedDartDevelopmentService implements DartDevelopmentService {
_localUri = remoteUri.replace(port: localPort);
_logger.printTrace('Local port forwarded DDS on $_localUri.');
_logger.sendEvent('device.proxied_dds_forwarded', <String, String>{
'deviceId': deviceId,
'remoteUri': remoteUri.toString(),
'localUri': _localUri!.toString(),
});
}
@override

View File

@ -440,6 +440,11 @@ void main() {
expect(dds.uri, Uri.parse('http://127.0.0.1:400/remote'));
expect(
bufferLogger.eventText.trim(),
'{"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"}}',
);
unawaited(dds.shutdown());
final DaemonMessage shutdownMessage = await broadcastOutput.first;