mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 06:35: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
|
@ -42,13 +42,26 @@ type searchInfo struct {
|
|||
|
||||
// This stores a map of active searches.
|
||||
type searches struct {
|
||||
core *Core
|
||||
searches map[crypto.NodeID]*searchInfo
|
||||
core *Core
|
||||
reconfigure chan bool
|
||||
searches map[crypto.NodeID]*searchInfo
|
||||
}
|
||||
|
||||
// Intializes the searches struct.
|
||||
func (s *searches) init(core *Core) {
|
||||
s.core = core
|
||||
s.reconfigure = make(chan bool, 1)
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case _ = <-s.reconfigure:
|
||||
s.core.configMutex.RLock()
|
||||
s.core.log.Println("Notified: searches")
|
||||
s.core.configMutex.RUnlock()
|
||||
continue
|
||||
}
|
||||
}
|
||||
}()
|
||||
s.searches = make(map[crypto.NodeID]*searchInfo)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue