This commit is contained in:
insanity@loafle.com 2017-08-04 11:37:00 +09:00
parent c8384ea1f9
commit 4e80885df2
2 changed files with 21 additions and 21 deletions

View File

@ -1,7 +1,7 @@
package initializer package initializer
import ( import (
cm "git.loafle.net/overflow/overflow_probe//agent_api/config_manager" cm "git.loafle.net/overflow/overflow_probe/agent_api/config_manager"
"google.golang.org/grpc" "google.golang.org/grpc"
"sync" "sync"
) )
@ -46,11 +46,11 @@ func (i *Initializer) getSecretKey() (string, error) {
addr := i.gconf.Central.Address + ":" + string(i.gconf.Central.Port) addr := i.gconf.Central.Address + ":" + string(i.gconf.Central.Port)
conn, err := grpc.Dial(addr, grpc.WithInsecure()) conn, err := grpc.Dial(addr, grpc.WithInsecure())
if err != nil { if err != nil {
return nil, err return "", err
} }
defer conn.Close() defer conn.Close()
return nil, nil return "", nil
} }

View File

@ -132,9 +132,9 @@ func (agt *Agent) waitAgentTask() {
d := <-agt.taskCh d := <-agt.taskCh
task := d.(msg.AgentTask) task := d.(msg.AgentTask)
switch task.Command { switch task.Command {
case msg.TASK_POL_INTERVAL_UPDATE: //case msg.TASK_POL_INTERVAL_UPDATE:
agt.processUpdatePolInterval(task) // agt.processUpdatePolInterval(task)
break // break
case msg.TASK_SENSOR_START: case msg.TASK_SENSOR_START:
agt.processStartSensor(task) agt.processStartSensor(task)
break break
@ -193,12 +193,12 @@ func (agt *Agent) stopAgent() {
dat.Stop(datStopped) dat.Stop(datStopped)
<-datStopped <-datStopped
//pol stop() ////pol stop()
polStopped := make(chan bool, 1) //polStopped := make(chan bool, 1)
if err := pol.Stop(polStopped); err != nil { //if err := pol.Stop(polStopped); err != nil {
return // return
} //}
<-polStopped //<-polStopped
evt.AddEventData(msg.Event{msg.EVT_TYPE_NONE, msg.EVENT_AGT_STOP, nil}) evt.AddEventData(msg.Event{msg.EVT_TYPE_NONE, msg.EVENT_AGT_STOP, nil})
evt.Stop() evt.Stop()
@ -281,12 +281,12 @@ func (agt *Agent) processSendLog(task msg.AgentTask) {
evt.AddEventData(msg.Event{msg.EVT_TYPE_TASK, task.Params["id"], nil}) evt.AddEventData(msg.Event{msg.EVT_TYPE_TASK, task.Params["id"], nil})
} }
func (agt *Agent) processUpdatePolInterval(task msg.AgentTask) { //func (agt *Agent) processUpdatePolInterval(task msg.AgentTask) {
interval := task.Params["interval"] // interval := task.Params["interval"]
err := pol.UpdateInterval(interval) // err := pol.UpdateInterval(interval)
if err != nil { // if err != nil {
log.Error(err) // log.Error(err)
return // return
} // }
evt.AddEventData(msg.Event{msg.EVT_TYPE_TASK, task.Params["id"], nil}) // evt.AddEventData(msg.Event{msg.EVT_TYPE_TASK, task.Params["id"], nil})
} //}