-
Notifications
You must be signed in to change notification settings - Fork 95
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
Remove ipv6 from default hosts on failure #29
Conversation
@jeffcharles @corpulentcoffee - do you mind pulling this branch and trying it out. Thanks! |
If anyone has suggestions for writing a unit test, I'm all ears Also, if anyone knows how to manually test this, I'm all ears. Can I disable (unless of course someone has a good stack overflow post they found saying i can manually test this without hurting my dear laptop in any way, even if it crashes before i re-enable ipv6 (poor thing crashes often actually, too often for a mac)) |
btw - i based the code on the idea that
|
FWIW, when I run with this patch, it works, but it doesn't seem to check every host in the list anymore. e.g. If using something like |
@corpulentcoffee - thank you so much - can you thanks again |
oh i see it, https://github.com/indexzero/node-portfinder/blob/handle-ipv6-errors/lib/portfinder.js#L105-L109 is nested under options.host check - run that with an options.host and it should work, update coming now |
sorry, my first answer was correct, do still mind logging that - ignore my comment about nesting under options.port, that was on purpose - the only other thing i see is that i don't use the async library so I need to look up everyLimit, 1 but @winfinit has assured me it is correct. if you do log that, let me know |
everyLimit is now called eachLimit - perhaps before it acted differently as @winfinit suggested - but as I have wondered and asked him - the limit is the number of times the iterator is called, so 127.0.0.1 is the only host tested, your correct - test for eachLimit, 0 - https://github.com/caolan/async/blob/master/test/test-async.js#L1039-L1049 anyone know which of the async methods i should use? I've got read the tests to find it, promises are my go to for a while now |
Hey @eriktrom: I added that plus some other logging, here's the output:
|
|
@corpulentcoffee - i've replaced everyLimit with async.each which looks correct from their tests - can you give one more shot and let me know your log output. Should work as expected now. Thanks again. |
@eriktrom This plain Here's the log with just the "entered testPort()" and "done w/ testPort()" messages:
|
yeah - must have been concurrent - looks like eachSeries is right choice - travis and appveyor (0.12 && 4.2 so far) now pass(for the push) |
ee4207b
to
f528d30
Compare
I think this means it works - (merged @corpulentcoffee's logging branch then ran tests) https://gist.github.com/eriktrom/6c38c85b85b4dfa9946b Appveyor for the pr(not the branch, aka the last push) is acting up. I rebased and re-pushed, hopefully it'll pull through, either way I think this is ready @corpulentcoffee - things good on your end now? EDIT: the tests that start with |
@eriktrom: So far, the latest version using One very minor harmless thing: when using something like
Maybe check to make sure |
@corpulentcoffee - again your feedback has been crucial to shipping this thanks so much regarding checking it twice - the reason we don't filter them is b/c the same port can be checked twice like in the case where you pass localhost and it resolves to 127.0.0.1 we check twice anyway - creating a non sparse array that removes duplicates is more complexity to the codebase, at the cost of double checking only one host twice, which we might do anyway(in the localhost case) so I didn't filter out duplicates into a non sparse array. (There are issues if the array is sparse btw b/c the missing items become undefined and thus add a host of undefined which resolves to odd things on different systems IIRC) (if you have a loop for that though, drop it here, i'll add it :) ) |
oh i do see, we add the same provided host for every iteration, adding up over time, haha, k |
fixed - nice catch there - would have kept pushing on the same user provided host for ports that we're not open, slowing down the code over time. was more than just one extra check, thanks! |
4312654
to
7b00c0e
Compare
98672be
to
31fc592
Compare
Keep up the good work guys :) |
Remove ipv6 from default hosts on failure Write test for removing duplicate hosts before running recursive iterator to find open port(s)
@indexzero - push to npm |
Works for me |
👯 |
Remove ipv6 from default hosts that we test each port against
to allow portfinder to work with machines that dont have ipv6
fixes #26 #28