Address records should not be cached
lilyball opened this issue · comments
This library appears to cache address records for announced services. The problem is if my computer’s available addresses change, the cache is now wrong. So either it shouldn’t be caching the records at all, or it should detect when the network interfaces change and invalidate all cached records.
I noticed this because I turned off wifi on my raspberry pi but the _hap._tcp. services continued to resolve to both the wifi and ethernet IP addresses.
I can’t prove this experimentally right now because my local device would have cached the data (and this library doesn’t send goodbye packets), and I restarted Homebridge already, but skimming through the code suggests that what I’ve written is correct. It looks like the only thing that will update the address records (beyond destroying and creating the Service) is calling updateTxt() as that throws away the cached packet.
Thanks for the issue. Bonjour is about to be replaced by the new ciao. It is already in use on the beta build of homebridge/hap-nodejs and does support properly updating the address records when the IP address changes.
Thanks for your issue. The bonjour library is about to be replaced by new ciao library (which is basically a rewrite). Ciao now correctly handles changes made to the network while running, thus the issue will be closed.