mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
more work in progress actorizing the remaining parts of the switch
This commit is contained in:
parent
15b850be6e
commit
9834f222db
9 changed files with 111 additions and 101 deletions
|
@ -46,6 +46,7 @@ type router struct {
|
|||
nodeinfo nodeinfo
|
||||
searches searches
|
||||
sessions sessions
|
||||
table *lookupTable // has a copy of our locator
|
||||
}
|
||||
|
||||
// Initializes the router struct, which includes setting up channels to/from the adapter.
|
||||
|
@ -77,6 +78,21 @@ func (r *router) init(core *Core) {
|
|||
r.sessions.init(r)
|
||||
}
|
||||
|
||||
func (r *router) updateTable(from phony.Actor, table *lookupTable) {
|
||||
r.Act(from, func() {
|
||||
r.table = table
|
||||
r.nodeinfo.Act(r, func() {
|
||||
r.nodeinfo.table = table
|
||||
})
|
||||
for _, ses := range r.sessions.sinfos {
|
||||
sinfo := ses
|
||||
sinfo.Act(r, func() {
|
||||
sinfo.table = table
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Reconfigures the router and any child modules. This should only ever be run
|
||||
// by the router actor.
|
||||
func (r *router) reconfigure() {
|
||||
|
@ -130,7 +146,7 @@ func (r *router) reset(from phony.Actor) {
|
|||
func (r *router) doMaintenance() {
|
||||
phony.Block(r, func() {
|
||||
// Any periodic maintenance stuff goes here
|
||||
r.core.switchTable.doMaintenance()
|
||||
r.core.switchTable.doMaintenance(r)
|
||||
r.dht.doMaintenance()
|
||||
r.sessions.cleanup()
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue