From 7468d08e4db535355b99de25b5bc95c04feea4b9 Mon Sep 17 00:00:00 2001 From: Skyxim Date: Sun, 26 Feb 2023 10:59:25 +0800 Subject: [PATCH] chore: periodically try fallback --- component/dialer/dialer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/component/dialer/dialer.go b/component/dialer/dialer.go index f7909175..cf4434d9 100644 --- a/component/dialer/dialer.go +++ b/component/dialer/dialer.go @@ -195,8 +195,8 @@ func dualStackDialContext( ipv4DialFn func(ctx context.Context) (net.Conn, error), ipv6DialFn func(ctx context.Context) (net.Conn, error), preferIPv4 bool) (net.Conn, error) { - fallbackTimer := time.NewTimer(fallbackTimeout) - defer fallbackTimer.Stop() + fallbackTicker := time.NewTicker(fallbackTimeout) + defer fallbackTicker.Stop() results := make(chan dialResult) returned := make(chan struct{}) defer close(returned) @@ -224,7 +224,7 @@ func dualStackDialContext( return fallback.Conn, nil } return nil, fmt.Errorf("dual stack connect failed: %w", err) - case <-fallbackTimer.C: + case <-fallbackTicker.C: if fallback.error == nil && fallback.Conn != nil { return fallback.Conn, nil }