more symmetry. SetupHeartBeat froma agent to server now done in separate
call.
This commit is contained in:
parent
91ea4632a3
commit
e9383caa01
@ -322,6 +322,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
comms.SetupHeartBeat(commChannel)
|
||||||
|
|
||||||
// initial check
|
// initial check
|
||||||
|
|
||||||
|
@ -68,8 +68,12 @@ func NewCommChannel(role Role, wsConn io.ReadWriteCloser) (CommChannel, error) {
|
|||||||
}
|
}
|
||||||
log.Println("Communication channel between agent and converge server established")
|
log.Println("Communication channel between agent and converge server established")
|
||||||
|
|
||||||
// heartbeat
|
return commChannel, nil
|
||||||
if role == Agent {
|
}
|
||||||
|
|
||||||
|
// Communication from agent to server during the session.
|
||||||
|
|
||||||
|
func SetupHeartBeat(commChannel CommChannel) {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
time.Sleep(10 * time.Second)
|
time.Sleep(10 * time.Second)
|
||||||
@ -82,13 +86,8 @@ func NewCommChannel(role Role, wsConn io.ReadWriteCloser) (CommChannel, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
|
||||||
|
|
||||||
return commChannel, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sending an event to the other side
|
|
||||||
|
|
||||||
func ListenForAgentEvents(channel GOBChannel,
|
func ListenForAgentEvents(channel GOBChannel,
|
||||||
agentInfo func(agent EnvironmentInfo),
|
agentInfo func(agent EnvironmentInfo),
|
||||||
sessionInfo func(session SessionInfo),
|
sessionInfo func(session SessionInfo),
|
||||||
|
Loading…
Reference in New Issue
Block a user