Support notifying components for config reload, listen for SIGHUP

This commit is contained in:
Neil Alexander 2018-12-29 18:51:51 +00:00
parent b4a7dab34d
commit 219fb96553
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
10 changed files with 189 additions and 36 deletions

View file

@ -10,13 +10,26 @@ import (
)
type multicast struct {
core *Core
sock *ipv6.PacketConn
groupAddr string
core *Core
reconfigure chan bool
sock *ipv6.PacketConn
groupAddr string
}
func (m *multicast) init(core *Core) {
m.core = core
m.reconfigure = make(chan bool, 1)
go func() {
for {
select {
case _ = <-m.reconfigure:
m.core.configMutex.RLock()
m.core.log.Println("Notified: multicast")
m.core.configMutex.RUnlock()
continue
}
}
}()
m.groupAddr = "[ff02::114]:9001"
// Check if we've been given any expressions
if len(m.core.ifceExpr) == 0 {