netcheck: ignore IPv4 STUN failures if we saw at least one reply

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2020-03-11 13:36:52 -07:00 committed by Brad Fitzpatrick
parent ed7e088729
commit 0d3f42e1d8
1 changed files with 14 additions and 1 deletions

View File

@ -296,7 +296,20 @@ func (c *Client) GetReport(ctx context.Context) (*Report, error) {
DNSCache: dnscache.Get(),
}
c.s4 = s4
grp.Go(func() error { return s4.Run(ctx) })
grp.Go(func() error {
err := s4.Run(ctx)
if err == nil {
return nil
}
mu.Lock()
defer mu.Unlock()
// If we got at least one IPv4 endpoint, treat that as
// good enough.
if gotEP4 != "" {
return nil
}
return err
})
if c.GetSTUNConn4 == nil {
go reader(s4, pc4)
}