mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
make the main library reconfiguration more actor-friendly
This commit is contained in:
parent
aa30c6cc98
commit
a3d4d8125b
9 changed files with 144 additions and 159 deletions
|
@ -117,20 +117,21 @@ func (c *Core) UpdateConfig(config *config.NodeConfig) {
|
|||
|
||||
errors := 0
|
||||
|
||||
components := []chan chan error{
|
||||
c.router.searches.reconfigure,
|
||||
c.router.dht.reconfigure,
|
||||
c.router.sessions.reconfigure,
|
||||
// Each reconfigure function should pass any errors to the channel, then close it
|
||||
components := []func(chan error){
|
||||
c.link.reconfigure,
|
||||
c.peers.reconfigure,
|
||||
c.router.reconfigure,
|
||||
c.router.dht.reconfigure,
|
||||
c.router.searches.reconfigure,
|
||||
c.router.sessions.reconfigure,
|
||||
c.switchTable.reconfigure,
|
||||
c.link.reconfigure,
|
||||
}
|
||||
|
||||
for _, component := range components {
|
||||
response := make(chan error)
|
||||
component <- response
|
||||
if err := <-response; err != nil {
|
||||
go component(response)
|
||||
for err := range response {
|
||||
c.log.Errorln(err)
|
||||
errors++
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue