mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-01-21 04:59:17 +01:00
BUGFIX
Don't get device each time it is an expensive operation.
This commit is contained in:
parent
3ef1b68ba5
commit
fd7bd80485
@ -180,6 +180,8 @@ func (m *WgMeshConfigApplyer) updateWgConf(mesh MeshProvider) error {
|
||||
routes := m.getRoutes(mesh)
|
||||
installedRoutes := make([]lib.Route, 0)
|
||||
|
||||
dev, _ := mesh.GetDevice()
|
||||
|
||||
for _, n := range nodes {
|
||||
if NodeEquals(n, self) {
|
||||
continue
|
||||
@ -202,7 +204,6 @@ func (m *WgMeshConfigApplyer) updateWgConf(mesh MeshProvider) error {
|
||||
continue
|
||||
}
|
||||
|
||||
dev, _ := mesh.GetDevice()
|
||||
peer, err := m.convertMeshNode(n, dev, peerToClients, routes)
|
||||
|
||||
if err != nil {
|
||||
@ -229,12 +230,6 @@ func (m *WgMeshConfigApplyer) updateWgConf(mesh MeshProvider) error {
|
||||
Peers: peerConfigs,
|
||||
}
|
||||
|
||||
dev, err := mesh.GetDevice()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = m.meshManager.GetClient().ConfigureDevice(dev.Name, cfg)
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user