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

@ -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)
}