fix race condition in windows agent update amidaware/tacticalrmm#1250

This commit is contained in:
wh1te909 2022-11-06 21:49:26 -08:00
parent eddafb873b
commit e11c38dd49
2 changed files with 2 additions and 1 deletions

View File

@ -154,7 +154,7 @@ func New(logger *logrus.Logger, version string) *Agent {
Option: service.KeyValue{ Option: service.KeyValue{
"StartType": "automatic", "StartType": "automatic",
"OnFailure": "restart", "OnFailure": "restart",
"OnFailureDelayDuration": "5s", "OnFailureDelayDuration": "12s",
"OnFailureResetPeriod": 10, "OnFailureResetPeriod": 10,
}, },
} }

View File

@ -479,6 +479,7 @@ func (a *Agent) RunRPC() {
atomic.StoreUint32(&agentUpdateLocker, 0) atomic.StoreUint32(&agentUpdateLocker, 0)
nc.Flush() nc.Flush()
nc.Close() nc.Close()
a.ControlService(winSvcName, "stop")
os.Exit(0) os.Exit(0)
} }
}(payload) }(payload)