Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
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 @@ -67,7 +67,7 @@ - (instancetype)init {
return self;
}

- (void)dealloc {
- (void)stopService {
#if TARGET_IPHONE_SIMULATOR
if (_dnsServiceRef) {
DNSServiceRefDeallocate(_dnsServiceRef);
Expand All @@ -76,20 +76,17 @@ - (void)dealloc {
#else // TARGET_IPHONE_SIMULATOR
[_netService.get() stop];
#endif // TARGET_IPHONE_SIMULATOR
}

- (void)dealloc {
[self stopService];

blink::DartServiceIsolate::RemoveServerStatusCallback(std::move(_callbackHandle));
[super dealloc];
}

- (void)publishServiceProtocolPort:(std::string)uri {
#if TARGET_IPHONE_SIMULATOR
if (_dnsServiceRef) {
DNSServiceRefDeallocate(_dnsServiceRef);
_dnsServiceRef = NULL;
}
#else // TARGET_IPHONE_SIMULATOR
[_netService.get() stop];
#endif // TARGET_IPHONE_SIMULATOR
[self stopService];
if (uri.empty()) {
return;
}
Expand All @@ -115,7 +112,7 @@ - (void)publishServiceProtocolPort:(std::string)uri {
if (err != 0) {
FML_LOG(ERROR) << "Failed to register observatory port with mDNS.";
} else {
DNSServiceProcessResult(_dnsServiceRef);
DNSServiceSetDispatchQueue(_dnsServiceRef, dispatch_get_main_queue());
}
#else // TARGET_IPHONE_SIMULATOR
_netService.reset([[NSNetService alloc] initWithDomain:@"local."
Expand All @@ -128,7 +125,7 @@ - (void)publishServiceProtocolPort:(std::string)uri {
}

- (void)netServiceDidPublish:(NSNetService*)sender {
FML_LOG(INFO) << "FlutterObservatoryPublisher is ready!";
FML_DLOG(INFO) << "FlutterObservatoryPublisher is ready!";
}

- (void)netService:(NSNetService*)sender didNotPublish:(NSDictionary*)errorDict {
Expand Down