mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-11 18:17:40 +00:00
move MapResponse peer logic into function and reuse
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:

committed by
Kristoffer Dalby

parent
387aa03adb
commit
432e975a7f
@@ -340,6 +340,8 @@ func (hsdb *HSDatabase) handlePrimarySubnetFailover() error {
|
||||
continue
|
||||
}
|
||||
|
||||
machine := &route.Machine
|
||||
|
||||
if !route.IsPrimary {
|
||||
_, err := hsdb.getPrimaryRoute(netip.Prefix(route.Prefix))
|
||||
if hsdb.isUniquePrefix(route) || errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
@@ -355,7 +357,7 @@ func (hsdb *HSDatabase) handlePrimarySubnetFailover() error {
|
||||
return err
|
||||
}
|
||||
|
||||
changedMachines = append(changedMachines, &route.Machine)
|
||||
changedMachines = append(changedMachines, machine)
|
||||
|
||||
continue
|
||||
}
|
||||
@@ -429,7 +431,7 @@ func (hsdb *HSDatabase) handlePrimarySubnetFailover() error {
|
||||
return err
|
||||
}
|
||||
|
||||
changedMachines = append(changedMachines, &route.Machine)
|
||||
changedMachines = append(changedMachines, machine)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user