Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Remove _dartobservatory._tcp legacy DNS registration type #51635

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,13 @@ @interface DartVMServiceDNSServiceDelegate : NSObject <FlutterDartVMServicePubli

@implementation DartVMServiceDNSServiceDelegate {
DNSServiceRef _dnsServiceRef;
DNSServiceRef _legacyDnsServiceRef;
}

- (void)stopService {
if (_dnsServiceRef) {
DNSServiceRefDeallocate(_dnsServiceRef);
_dnsServiceRef = NULL;
}
if (_legacyDnsServiceRef) {
DNSServiceRefDeallocate(_legacyDnsServiceRef);
_legacyDnsServiceRef = NULL;
}
}

- (void)publishServiceProtocolPort:(NSURL*)url {
Expand All @@ -91,7 +86,6 @@ - (void)publishServiceProtocolPort:(NSURL*)url {
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];
Expand All @@ -107,20 +101,6 @@ - (void)publishServiceProtocolPort:(NSURL*)url {
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 "
Expand Down