mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Support notifying components for config reload, listen for SIGHUP
This commit is contained in:
parent
b4a7dab34d
commit
219fb96553
10 changed files with 189 additions and 36 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue