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

Propagate TTLs from new messages into the cache. #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

blakej11
Copy link

I've tried using a few Golang libraries for mDNS in the past couple days. I found https://github.com/grandcat/zeroconf and then this one, and I noticed that this one actually does things with the TTLs returned with mDNS entries. That appears to be because this fork has this commit, which the parent repo doesn't have.

When experimenting with it, I discovered that this updated TTL support doesn't quite work. Specifically, (*client).mainloop accumulates new responses into the entries map, and once it has sent information about a new service to the subscriber, it stores a copy of it in the sentEntries map. It has code to delete entries from the sentEntries map once they expire. But if it receives updated information for an entry, it doesn't propagate the new Expiry time to the entry in sentEntries, so that entry will be missing between the expiry of the original message and when it receives a new message for it.

This PR has a simple fix for this - propagate the updated Expiry time from any new entries that it receives.

I've seen comments in other PRs saying "please submit this to the parent, we don't want to deal with the maintenance burden". As far as I can tell, this issue is specific to your fork, so I think this is the right place to send it. Also, if you don't want it, no worries.

@blakej11 blakej11 changed the title Cause cached entries to actually expire. Propagate TTLs from new messages into the cache. Aug 29, 2024
@blakej11
Copy link
Author

@marten-seemann tagging you for consideration of this PR - I think this is a bug in your fork of the zeroconf library. If you don't want to take it, that's totally fine, but I thought I'd offer.

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.

1 participant