fix: dead loop if no dns upstream given

This commit is contained in:
mzz2017 2023-03-03 16:53:09 +08:00
parent adfcef4d13
commit 4706f58d22
2 changed files with 1 additions and 5 deletions

View File

@ -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
}

View File

@ -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,