mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 06:35:07 +03:00
Handle errors from reconfigure tasks
This commit is contained in:
parent
2925920c70
commit
7fae1c993a
9 changed files with 64 additions and 72 deletions
|
@ -43,22 +43,19 @@ type searchInfo struct {
|
|||
// This stores a map of active searches.
|
||||
type searches struct {
|
||||
core *Core
|
||||
reconfigure chan bool
|
||||
reconfigure chan chan error
|
||||
searches map[crypto.NodeID]*searchInfo
|
||||
}
|
||||
|
||||
// Intializes the searches struct.
|
||||
func (s *searches) init(core *Core) {
|
||||
s.core = core
|
||||
s.reconfigure = make(chan bool, 1)
|
||||
s.reconfigure = make(chan chan error, 1)
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case _ = <-s.reconfigure:
|
||||
s.core.configMutex.RLock()
|
||||
s.core.log.Println("Notified: searches")
|
||||
s.core.configMutex.RUnlock()
|
||||
continue
|
||||
case e := <-s.reconfigure:
|
||||
e <- nil
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue