mirror of https://bitbucket.org/ausocean/av.git
Use netsender.IsConfigured() rather than maintaining a global.
This commit is contained in:
parent
b2269ef8d8
commit
de633f1061
13
RevidCLI.go
13
RevidCLI.go
|
@ -92,7 +92,6 @@ const (
|
|||
|
||||
// Globals
|
||||
var (
|
||||
configReceived bool = true
|
||||
varSum int = 0
|
||||
vars = make(map[string]string)
|
||||
revidInst revid.Revid
|
||||
|
@ -278,24 +277,14 @@ func netsenderInit() {
|
|||
config.Logger = netsender.GetLogger()
|
||||
netsender.Init(false)
|
||||
netsender.ExternalReader = revidReportActions
|
||||
|
||||
//try get initial config
|
||||
if err := netsender.GetConfig(); err != nil {
|
||||
//default to a config?????
|
||||
config.Logger.Log("Error", err.Error())
|
||||
} else {
|
||||
configReceived = true
|
||||
}
|
||||
}
|
||||
|
||||
//periodicNetsenderReport is called by the main function every monPeriod seconds. It makes sure a config has been recieved, and then
|
||||
//reports back CPU stats and updates vars
|
||||
func periodicNetsenderReport() {
|
||||
if !configReceived {
|
||||
if !netsender.IsConfigured() {
|
||||
if err := netsender.GetConfig(); err != nil {
|
||||
config.Logger.Log("Error", err.Error())
|
||||
} else {
|
||||
configReceived = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue