apple / apple/swift-async-dns-resolver

Make DNSSD queries cancellable

Open
#32 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
160
Forks
33
PR merge metrics
No merged PRs in 30d

Description

Hi!
First of all, thanks for this great lib!

I'd like to be able to cancel queries made with the DNSSD Resolver, because the timeout is pretty long and it would be nice to be able to cancel the Task after a custom timeout.
I've seen that the cancellation behavior is implemented for the Ares Resolver and I've tried to make it work for the DNSSD Resolver.
I implemented the `onTermination` method of the stream continuation, however this produces a warning when trying to call `DNSServiceRefDeallocate` on the pointer, since it isn't a Sendable type and it could be modified by several threads at the same time.

I am not very experienced in the inner workings of Swift concurrency, how could the DNSSD queries cancellation be implemented?

Thanks and have a nice day!

Contributor guide

Open the contributing guide

Research direction

Start by comparing the existing Ares Resolver cancellation behavior with the DNSSD Resolver’s stream continuation and its onTermination handling. Examine how DNSServiceRefDeallocate can be coordinated safely under Swift concurrency. Done means a DNSSD query can be cancelled after a caller-defined timeout without unsafe concurrent access or a Sendable warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.