refactor: deduplicate primary parent view selection in Collect
Replace the inline loop with a call to the existing primaryParentView() helper so the selection algorithm lives in exactly one place.
This commit is contained in:
parent
c884f3f80a
commit
7e8faa7169
1 changed files with 1 additions and 7 deletions
|
|
@ -89,13 +89,7 @@ func (p *delegationProvider) Collect(ctx context.Context, opts sdk.CheckerOption
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no parent answered with an NS RRset, skip Phase B; rules flag the gap.
|
// If no parent answered with an NS RRset, skip Phase B; rules flag the gap.
|
||||||
var primary *ParentView
|
primary := primaryParentView(data.ParentViews)
|
||||||
for i := range data.ParentViews {
|
|
||||||
if data.ParentViews[i].UDPNSError == "" && len(data.ParentViews[i].NS) > 0 {
|
|
||||||
primary = &data.ParentViews[i]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if primary == nil {
|
if primary == nil {
|
||||||
return data, nil
|
return data, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue