Windows: manually check if we can bind on the configured port/ports

Windows allows the coexistence of three types of sockets on the same
transport-layer service port, for example, 127.0.0.1:8080, [::1]:8080
and [::ffff:0.0.0.0]:8080

Go don't properly handles this, so we use a ugly hack

Fixes #350
This commit is contained in:
Nicola Murino
2021-03-21 22:21:04 +01:00
parent f7c7e2951d
commit 54c0c1b80d
5 changed files with 27 additions and 3 deletions

View File

@@ -232,6 +232,7 @@ func (c *Configuration) Initialize(configDir string) error {
go func(binding Binding) {
addr := binding.GetAddress()
utils.CheckTCP4Port(binding.Port)
listener, err := net.Listen("tcp", addr)
if err != nil {
logger.Warn(logSender, "", "error starting listener on address %v: %v", addr, err)