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

Delete cached reference after stopping interface #16

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

Conversation

wasnotrice
Copy link

@wasnotrice wasnotrice commented Sep 24, 2019

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 activeInterfaces on stop solves
the 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).

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.
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.

Stale multicast address
1 participant