From be4448448d04da20a74f16e42b86e5384d489029 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 29 Mar 2024 13:20:05 -0700 Subject: [PATCH] Remove _dartobservatory._tcp legacy DNS registration type (flutter/engine#51635) As of https://github.com/flutter/flutter/pull/121606 the flutter tool no longer registers for the legacy `_dartobservatory._tcp` DNS type. Remove the fallback and just register for the preferred `_dartVmService._tcp`. See also https://github.com/dart-lang/sdk/issues/50233 --- .../Source/FlutterDartVMServicePublisher.mm | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm index b9473566ca..38288a1f24 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm @@ -65,7 +65,6 @@ @implementation DartVMServiceDNSServiceDelegate { DNSServiceRef _dnsServiceRef; - DNSServiceRef _legacyDnsServiceRef; } - (void)stopService { @@ -73,10 +72,6 @@ DNSServiceRefDeallocate(_dnsServiceRef); _dnsServiceRef = NULL; } - if (_legacyDnsServiceRef) { - DNSServiceRefDeallocate(_legacyDnsServiceRef); - _legacyDnsServiceRef = NULL; - } } - (void)publishServiceProtocolPort:(NSURL*)url { @@ -91,7 +86,6 @@ uint32_t interfaceIndex = 0; #endif // TARGET_IPHONE_SIMULATOR const char* registrationType = "_dartVmService._tcp"; - const char* legacyRegistrationType = "_dartobservatory._tcp"; const char* domain = "local."; // default domain uint16_t port = [[url port] unsignedShortValue]; @@ -107,20 +101,6 @@ return; } - // TODO(bkonyi): remove once flutter_tools no longer looks for the legacy registration type. - // See https://github.com/dart-lang/sdk/issues/50233 - // - // Try to fallback on the legacy registration type. - err = DNSServiceRegister(&_legacyDnsServiceRef, flags, interfaceIndex, - FlutterDartVMServicePublisher.serviceName.UTF8String, - legacyRegistrationType, domain, NULL, htons(port), txtData.length, - txtData.bytes, RegistrationCallback, NULL); - - if (err == 0) { - DNSServiceSetDispatchQueue(_legacyDnsServiceRef, dispatch_get_main_queue()); - return; - } - FML_LOG(ERROR) << "Failed to register Dart VM Service port with mDNS with error " << err << "."; if (@available(iOS 14.0, *)) { FML_LOG(ERROR) << "On iOS 14+, local network broadcast in apps need to be declared in "