add subscribe for node events

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2018-06-09 13:28:25 -04:00
parent aa0c2abf84
commit 5dace354b7
No known key found for this signature in database
GPG key ID: A519480096146526

View file

@ -50,3 +50,15 @@ func NewAgent(cfg *Config) (*Agent, error) {
grpcServer: grpcServer, grpcServer: grpcServer,
}, nil }, nil
} }
// Subscribe subscribes to the node event channel
func (a *Agent) Subscribe(ch chan *NodeEvent) {
go func() {
for {
select {
case evt := <-a.nodeEventChan:
ch <- evt
}
}
}()
}