mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
fix: improve listener configuration and error logging
- Add condition to skip port 53 attempts when using zero IP address - Improve error logging by using structured error field instead of string formatting - Remove redundant error information from log message format The changes prevent unnecessary port 53 binding attempts when using zero IP addresses and improve log readability by using zap's structured error fields.
This commit is contained in:
committed by
Cuong Manh Le
parent
ddbb0f0db4
commit
ec85b1621d
@@ -1247,6 +1247,9 @@ func tryUpdateListenerConfig(cfg *ctrld.Config, notifyFunc func(), fatal bool) (
|
||||
// config, so we can always listen on localhost port 53, but no traffic could be routed there.
|
||||
tryLocalhost := !isLoopback(listener.IP)
|
||||
tryAllPort53 := true
|
||||
if isZeroIP && listener.Port == 53 {
|
||||
tryAllPort53 = false
|
||||
}
|
||||
|
||||
attempts := 0
|
||||
maxAttempts := 10
|
||||
@@ -1261,7 +1264,7 @@ func tryUpdateListenerConfig(cfg *ctrld.Config, notifyFunc func(), fatal bool) (
|
||||
break
|
||||
}
|
||||
|
||||
logMsg(il.Info(), n, "error listening on address: %s, error: %v", addr, err)
|
||||
logMsg(il.Info().Err(err), n, "error listening on address: %s", addr)
|
||||
|
||||
if !check.IP && !check.Port {
|
||||
if fatal {
|
||||
|
||||
Reference in New Issue
Block a user