mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-08-18 00:49:47 +02:00
Adding aliases that automatically gets added
This commit is contained in:
@@ -30,6 +30,11 @@ type SyncerImpl struct {
|
||||
|
||||
// Sync: Sync random nodes
|
||||
func (s *SyncerImpl) Sync(meshId string) error {
|
||||
if !s.manager.HasChanges(meshId) && s.infectionCount == 0 {
|
||||
logging.Log.WriteInfof("No changes for %s", meshId)
|
||||
return nil
|
||||
}
|
||||
|
||||
logging.Log.WriteInfof("UPDATING WG CONF")
|
||||
err := s.manager.ApplyConfig()
|
||||
|
||||
@@ -37,11 +42,6 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
||||
logging.Log.WriteInfof("Failed to update config %w", err)
|
||||
}
|
||||
|
||||
if !s.manager.HasChanges(meshId) && s.infectionCount == 0 {
|
||||
logging.Log.WriteInfof("No changes for %s", meshId)
|
||||
return nil
|
||||
}
|
||||
|
||||
theMesh := s.manager.GetMesh(meshId)
|
||||
|
||||
if theMesh == nil {
|
||||
@@ -50,6 +50,8 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
||||
|
||||
snapshot, err := theMesh.GetMesh()
|
||||
|
||||
s.manager.GetMonitor().Trigger(meshId, snapshot)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -111,6 +113,14 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
||||
logging.Log.WriteInfof("SYNC COUNT: %d", s.syncCount)
|
||||
|
||||
s.infectionCount = ((s.conf.InfectionCount + s.infectionCount - 1) % s.conf.InfectionCount)
|
||||
|
||||
newMesh := s.manager.GetMesh(meshId)
|
||||
snapshot, err = newMesh.GetMesh()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user