From 3140a0bc5380a4cb6266e3922969095204fb89dc Mon Sep 17 00:00:00 2001 From: frank Date: Mon, 20 Nov 2023 13:15:59 +0800 Subject: [PATCH] local pair: check netIPs if empty before find server cert (#4333) --- server/pairing/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/pairing/client.go b/server/pairing/client.go index ab8b7b09a..621ec20da 100644 --- a/server/pairing/client.go +++ b/server/pairing/client.go @@ -99,6 +99,12 @@ func NewBaseClient(c *ConnectionParams, logger *zap.Logger) (*BaseClient, error) signal.SendLocalPairingEvent(Event{Type: EventConnectionError, Error: err.Error(), Action: ActionConnect}) return nil, err } + // if client and server aren't on the same network, netIPs maybe empty, we should check it before invoking findServerCert + if len(netIPs) == 0 { + logger.Error("[local pair client] no reachable addresses found") + signal.SendLocalPairingEvent(Event{Type: EventConnectionError, Error: "no reachable addresses found", Action: ActionConnect}) + return nil, fmt.Errorf("no reachable addresses found") + } maxRetries := 3 for i := 0; i < maxRetries; i++ {