Delete cached reference after stopping interface#16
Open
wasnotrice wants to merge 1 commit intoDeMille:masterfrom
Open
Delete cached reference after stopping interface#16wasnotrice wants to merge 1 commit intoDeMille:masterfrom
wasnotrice wants to merge 1 commit intoDeMille:masterfrom
Conversation
This fixes an issue where the library could use a stale multicast
address.
Steps to reproduce:
1. Connect to a wifi network
2. Start a dnssd browser
3. Stop the dnssd browser
4. Connect to a different wifi network
5. Start a dnssd browser
An error like this is thrown:
Error: setMulticastInterface EADDRNOTAVAIL
at Socket.setMulticastInterface (dgram.js:566:11)
at Socket.eval (webpack:///./node_modules/dnssd/lib/NetworkInterface.js?:238:41)
at Socket.emit (events.js:182:13)
at startListening (dgram.js:128:10)
at state.handle.lookup (dgram.js:249:7)
at process._tickCallback (internal/process/next_tick.js:63:19)
This is because we are still using the IP address from the first
NetworkInterface instance, even though it is not valid for the new
network. Clearing the interface from `activeInterfaces` on stop solves
the problem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17
The issue is that we were still using the IP address from the first
NetworkInterface instance, even though it is not valid for the new
network. Clearing the interface from
activeInterfaceson stop solvesthe problem.
I added a test that works on node 10.5.0 (version of last passing travis run), but the whole suite fails on newer node versions, something to do with the fake socket in tests. The suite fails for me on node 10.9.0 and 10.15.2 (the versions I happen to have installed).