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

handling A additionals and out-of-order results, so that the correct IP address can be parsed #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

catdad
Copy link
Contributor

@catdad catdad commented Jun 1, 2018

this addressed #32

@Ivshti
Copy link
Collaborator

Ivshti commented Jun 7, 2018

@mafintosh what do you think? This looks good to me

…ing up result parsing or multicast-dns results
@catdad
Copy link
Contributor Author

catdad commented Jun 12, 2018

I restarted my computer today and started getting some unexpected behavior again today... so back to investigating I go.

I found that there is some conflict between multicast-dns results and node-ssdp results. The results parsed from node-ssdp seem to do everything "correctly", as in it gets to correct friendly name and correct host IP. The results parsed from multicast-dns can sometimes do one of two things wrong: it may get a weird id name (i.e. Chromecast-072d136d971669e2275836bf56482f43._googlecast._tcp.local) rather than the friendly name or it might get the wrong host IP (which is what I originally set out to fix). This appears to happen because multicast-dns does not return the answers and additionals in the same order every time (not sure why), but since partial devices get added to the list and emitted, it looks like it's possible for these results to have all expected data or have either the name or host wrong.

This seems to introduce some race conditions. I found that I may get only 2 results (expected for my network), I may get 3 results (with one device repeating, but internally having 2 different names so appearing as 2 devices), or get 4 results with both of my devices repeating.

I attempted to clean all this up, resolve differences between multicast-dns and node-ssdp, and make sure that there are no device duplicates and both host and friendly name are parsed with the correct priority from the results, regardless of order.

Though I have updated this branch (and this PR), it's significantly different from the first implementation, so please let me know if you prefer a different PR (I personally prefer keeping the history and conversation in one place, so I am opting to update this PR).

@Ivshti
Copy link
Collaborator

Ivshti commented Jun 22, 2018

@catdad please update this PR and let me know when you consider it ready, so I can properly review and merge

cc @core1024 on testing this

@catdad catdad changed the title handling A additionals, so that the correct IP address can be parsed handling A additionals and out-of-order results, so that the correct IP address can be parsed Jun 22, 2018
@catdad
Copy link
Contributor Author

catdad commented Jun 22, 2018

@Ivshti The PR is already up to date with the latest code I have that I have been using for a little over a week now in one of my active projects. It is ready for a review.

@gabrielgradinaru
Copy link

Any progress on this?

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.

3 participants