mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
cmd/ctrld: fatal loudly if listen failed
For address already in use error when listening, we have a workaround to spawn a new listener on different port. However, if that case does not match, we must fatal to notice the error to user.
This commit is contained in:
committed by
Cuong Manh Le
parent
beca95d5b9
commit
318fec27de
@@ -119,6 +119,9 @@ func (p *prog) run() {
|
||||
proxyLog.Fatal().Err(err).Msgf("Unable to start dns proxy on listener.%s", listenerNum)
|
||||
return
|
||||
}
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if opErr, ok := err.(*net.OpError); ok {
|
||||
if sErr, ok := opErr.Err.(*os.SyscallError); ok && errors.Is(opErr.Err, syscall.EADDRINUSE) || errors.Is(sErr.Err, errWindowsAddrInUse) {
|
||||
@@ -159,6 +162,7 @@ func (p *prog) run() {
|
||||
}
|
||||
}
|
||||
}
|
||||
proxyLog.Fatal().Err(err).Msgf("Unable to start dns proxy on listener.%s", listenerNum)
|
||||
}(listenerNum)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user