From 0d3f42e1d88847f6e66e0ec9896240879b646c7e Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 11 Mar 2020 13:36:52 -0700 Subject: [PATCH] netcheck: ignore IPv4 STUN failures if we saw at least one reply Signed-off-by: Brad Fitzpatrick --- netcheck/netcheck.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/netcheck/netcheck.go b/netcheck/netcheck.go index 3f31a200a..60fb262ad 100644 --- a/netcheck/netcheck.go +++ b/netcheck/netcheck.go @@ -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) }