Skip to content

Commit

Permalink
3.2.1 Ensure Version gets updated
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-nettica committed Sep 17, 2024
1 parent 889eff8 commit 62e153a
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ func (w *Worker) StartServer() {
log.Infof("Logging: %s", w.Context.Config.Device.Logging)
log.Info("=====================================================")

if w.Context.Config.Device.Version != Version {
log.Infof("Device version now %s; UPDATING SERVER", Version)
w.Context.Config.Device.Version = Version
w.UpdateNetticaDevice(*w.Context.Config.Device)
}

for {
tick := <-w.Context.Running

Expand All @@ -94,7 +88,7 @@ func (w *Worker) StartServer() {
localIP = ip
}

etag, err = w.GetNetticaVPN(etag)
etag2, err := w.GetNetticaVPN(etag)
if err != nil {
log.Errorf("Error getting nettica message: %v", err)
success = false
Expand All @@ -120,6 +114,20 @@ func (w *Worker) StartServer() {
FailSafeActed = false
FailSafeMsgSent = false
Count = 0

// If this is the first iteration, update the device info if necessary
if etag == "" {
if w.Context.Config.Device.Version != Version {
log.Infof("Device version now %s; UPDATING SERVER", Version)
w.Context.Config.Device.Version = Version
w.Context.Config.Device.OS = runtime.GOOS
w.Context.Config.Device.Architecture = runtime.GOARCH
w.UpdateNetticaDevice(*w.Context.Config.Device)
}

}

etag = etag2
}
}
}
Expand Down

0 comments on commit 62e153a

Please sign in to comment.