-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mdns::Publisher
signals resolved with the first address
#2711
Comments
Reading mDNSResponder source code and API documentation, there is the following flag which can indicate whether more result is coming (callback will be called again immediately). kDNSServiceFlagsMoreComing = 0x1,
/* MoreComing indicates to a callback that at least one more result is
* queued and will be delivered following immediately after this one.
* When the MoreComing flag is set, applications should not immediately
* update their UI, because this can result in a great deal of ugly flickering
* on the screen, and can waste a great deal of CPU time repeatedly updating
* the screen with content that is then immediately erased, over and over.
* Applications should wait until MoreComing is not set, and then
* update their UI when no more changes are imminent.
* When MoreComing is not set, that doesn't mean there will be no more
* answers EVER, just that there are no more answers immediately
* available right now at this instant. If more answers become available
* in the future they will be delivered as usual.
*/ This is also mentioned in the documentation of the callback (to resolve/retrive the addresses) /**
...
* @param flags
* Possible values are kDNSServiceFlagsMoreComing and
* kDNSServiceFlagsAdd.
...
*/
typedef void (DNSSD_API *DNSServiceGetAddrInfoReply)
(
DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *hostname,
const struct sockaddr *address,
uint32_t ttl,
void *context
); We should use this flag. |
Avahi seems to have a different way for this. Instead of a flag, it uses /** Type of callback event when browsing */
typedef enum {
AVAHI_BROWSER_NEW, /**< The object is new on the network */
AVAHI_BROWSER_REMOVE, /**< The object has been removed from the network */
AVAHI_BROWSER_CACHE_EXHAUSTED, /**< One-time event, to notify the user that all entries from the caches have been sent */
AVAHI_BROWSER_ALL_FOR_NOW, /**< One-time event, to notify the user that more records will probably not show up in the near future, i.e. all cache entries have been read and all static servers been queried */
AVAHI_BROWSER_FAILURE /**< Browsing failed due to some reason which can be retrieved using avahi_server_errno()/avahi_client_errno() */
} AvahiBrowserEvent; The |
Copying the comment from the #2712
|
We noticed this while investigating the code and some related issues. The background for this stems from the following PRs:
In the above PRs, we aimed to fix the issue where the
Publisher
is filtering link-local addresses, and move the filtering toDiscoveryProxy
. This is done because link-local addresses should now be preferred and used for TREL peers, so we cannot have them filtered by thePublisher
.The
Mdns::Publisher
implementation (with mDNSResponder) when resolving a host or service seem to invoke the callback indicating "resolved" upon getting the first IPv6 address.PublisherMDnsSd::ServiceInstanceResolution::HandleGetAddrInfoResult()
is the callback which is called, passing the addresses one by one (it has a singleconst struct sockaddr *aAddress
input).FinishResolution
,OnServiceResolved()
is called.I think we should aim to improve and fix this behavior.
I think the implemenation with Avahi is also behaving in the same way.
FYI. @superwhd @librasungirl @bukepo @wgtdkp
The text was updated successfully, but these errors were encountered: