generator
generator copied to clipboard
Fixes issues where Node doesn't error if port is in use.
This fixes #206
Working on a solution now. I'm going to update this PR to better describe what is happening and how the fix would solve that.
After a lot of research, I have reverted part of my fix and provided a test for it. The issue that I was having is an OS specific issue. If you have IPv6 enabled it will not necessarily block IPv4 for listening. I've added a comment block to explain more what is happening incase other engineers have this issue with their app.
I've also added in a catch for an error condition that may return on Linux when kernel option ipv6.disable=1
is used. I did not force listening on IPv4 under that condition and instead opted for alerting the engineer of the issue so they can make a decision based on their environment.
Sources:
ipv6only listen/bind option https://github.com/nodejs/node/issues/17664
Why listening "::" (all IPv6) also get "0.0.0.0"(all IPv4) listened? https://github.com/nodejs/node/issues/9390
IPv6: Is ::' equivalent to
0.0.0.0' when listening for connections?
https://stackoverflow.com/questions/27480094/ipv6-is-equivalent-to-0-0-0-0-when-listening-for-connections
Sorry I haven't gotten back to this. I will try to get to this before the end of the month.