From 32beb14f173313d3b77205400ef9051e677fd0da Mon Sep 17 00:00:00 2001 From: Sakurapainting Date: Fri, 27 Mar 2026 23:48:13 +0800 Subject: [PATCH] fix(gateway): fix error wrapping and scope in channel-only host resolution --- pkg/gateway/channel_only.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/gateway/channel_only.go b/pkg/gateway/channel_only.go index b60fa5f1d..d1d2debad 100644 --- a/pkg/gateway/channel_only.go +++ b/pkg/gateway/channel_only.go @@ -196,7 +196,8 @@ func resolveChannelOnlyListenHost(host string, port int) (string, error) { if err := probeTCPBind(host, port); err == nil { return host, nil } else if isLoopbackHost(host) { - if fallbackErr := probeTCPBind("0.0.0.0", port); fallbackErr == nil { + fallbackErr := probeTCPBind("0.0.0.0", port) + if fallbackErr == nil { logger.WarnCF( "channels", "Loopback host unavailable in channel-only mode, fallback to wildcard", @@ -207,7 +208,14 @@ func resolveChannelOnlyListenHost(host string, port int) (string, error) { ) return "0.0.0.0", nil } - return "", fmt.Errorf("bind %s:%d failed: %w", host, port, err) + return "", fmt.Errorf( + "bind fallback 0.0.0.0:%d failed after %s:%d failed: %w (original error: %v)", + port, + host, + port, + fallbackErr, + err, + ) } else { return "", fmt.Errorf("bind %s:%d failed: %w", host, port, err) }