Skip to content
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

Fixes and additions to make it work with dns-sd #2

Merged
merged 8 commits into from
Mar 2, 2015
Merged

Fixes and additions to make it work with dns-sd #2

merged 8 commits into from
Mar 2, 2015

Conversation

brutella
Copy link
Contributor

I'm using this library with my changes pretty heavily and it works reliably enough that I would like to see my changes in the main repo.
Here is what changed and why.

Server

Fixes

  • Send unicast responds if requested (server.go:315)
  • Register() now returns a Server instance because the server shutdown is done by calling Shutdown() instead of using the shutdown channel.

Problem with a shutdown channel arises when it's not clear how long the shutdown will take because the shutdown process runs in a separate goroutine. It may happen that the program terminates before the server was able to send goodbye packets. This can be prevented by calling Shutdown().

Additions

  • Send unsolicited responses during probing (server.go:547)
  • Set the cache flush bit in composeLookupAnswers() (server.go:411)
  • SetText() update and reannounces TXT records
  • Respond to_services._dns-sd._udp.<domain> dns query (server.go:343)

A DNS query for PTR records with the name "_services._dns-sd._udp." yields a set of PTR records, where the rdata of each PTR record is the two-label name, plus the same domain, e.g. "_http._tcp.". From mDNS RFC

Client

  • Correctly send to ipv6 connection

Send multiple announcement messages in doubled intervals
Those methods returned the shutdown channel before, which was used for signaling a shutdown.
On server shutdown multicast messages are sent for SRV and TXT records with TTL 0. From the outside
you don't know how long this takes. It may happen that the app terminates before any message
was successfully sent. Now Shutdown() is called manually which returns when all messages were sent.

Add method to set and announce new text records
@oleksandr
Copy link
Owner

Thanks. The changes look good to me. I'm glad the library is getting better - it was a really quick roll out as we needed bonjour in our project ASAP.

oleksandr pushed a commit that referenced this pull request Mar 2, 2015
Fixes and additions to make it work with dns-sd
@oleksandr oleksandr merged commit 415cafc into oleksandr:master Mar 2, 2015
@brutella brutella mentioned this pull request Jun 2, 2015
wesen added a commit to wesen/bonjour that referenced this pull request Nov 22, 2018
✨ Restructure bonjour server to take a chan of entries, allowing for live update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants