local pair: check netIPs if empty before find server cert (#4333)

This commit is contained in:
frank 2023-11-20 13:15:59 +08:00 committed by GitHub
parent c012f94681
commit 3140a0bc53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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++ {