]> git.meshlink.io Git - meshlink/commitdiff
Handle not being able to bind to the configured port at startup.
authorGuus Sliepen <guus@meshlink.io>
Fri, 6 Mar 2020 23:19:57 +0000 (00:19 +0100)
committerGuus Sliepen <guus@meshlink.io>
Fri, 6 Mar 2020 23:19:57 +0000 (00:19 +0100)
When starting a MeshLink node that has already been configured to run on a
certain port, but that port is in use (for one or more of the supported
address families), it would either ignore some address families, or would
try to bind to port 0 if all address families failed. However, this is
problematic, because it makes discovery and invitation URL generation much
harder.

Fix this by checking if any port binding fails for a supported address
family, and if so, try to find another port that does support binding on
all address families. If it fails to find any available port, it will fall
back to binding to port 0, so that outgoing connections are still possible.


No differences found