mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +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
|
@ -162,6 +162,7 @@ type switchData struct {
|
|||
// All the information stored by the switch.
|
||||
type switchTable struct {
|
||||
core *Core
|
||||
reconfigure chan bool
|
||||
key crypto.SigPubKey // Our own key
|
||||
time time.Time // Time when locator.tstamp was last updated
|
||||
drop map[crypto.SigPubKey]int64 // Tstamp associated with a dropped root
|
||||
|
@ -184,6 +185,7 @@ const SwitchQueueTotalMinSize = 4 * 1024 * 1024
|
|||
func (t *switchTable) init(core *Core, key crypto.SigPubKey) {
|
||||
now := time.Now()
|
||||
t.core = core
|
||||
t.reconfigure = make(chan bool, 1)
|
||||
t.key = key
|
||||
locator := switchLocator{root: key, tstamp: now.Unix()}
|
||||
peers := make(map[switchPort]peerInfo)
|
||||
|
@ -808,6 +810,11 @@ func (t *switchTable) doWorker() {
|
|||
}
|
||||
case f := <-t.admin:
|
||||
f()
|
||||
case _ = <-t.reconfigure:
|
||||
t.core.configMutex.RLock()
|
||||
t.core.log.Println("Notified: switchTable")
|
||||
t.core.configMutex.RUnlock()
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue