From 4706f58d229ed545578a0f1aee0ff645a4fae4a4 Mon Sep 17 00:00:00 2001 From: mzz2017 <2017@duck.com> Date: Fri, 3 Mar 2023 16:53:09 +0800 Subject: [PATCH] fix: dead loop if no dns upstream given --- component/dns/dns.go | 4 +--- control/control_plane.go | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/component/dns/dns.go b/component/dns/dns.go index 6689263..67dc48e 100644 --- a/component/dns/dns.go +++ b/component/dns/dns.go @@ -110,9 +110,7 @@ func New(log *logrus.Logger, dns *config.Dns, opt *NewOption) (s *Dns, err error } if len(dns.Upstream) == 0 { // Immediately ready. - if err = opt.UpstreamReadyCallback(nil, nil); err != nil { - return nil, err - } + go opt.UpstreamReadyCallback(nil, nil) } return s, nil } diff --git a/control/control_plane.go b/control/control_plane.go index 2598e4d..804718b 100644 --- a/control/control_plane.go +++ b/control/control_plane.go @@ -294,7 +294,6 @@ func NewControlPlane( if err != nil { return nil, fmt.Errorf("RoutingMatcherBuilder.BuildKernspace: %w", err) } - /// Dial mode. dialMode, err := consts.ParseDialMode(global.DialMode) if err != nil { @@ -325,7 +324,6 @@ func NewControlPlane( if err != nil { return nil, err } - /// Dns controller. if plane.dnsController, err = NewDnsController(dnsUpstream, &DnsControllerOption{ Log: log,