mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
start migrating sessionInfo to be an actor
This commit is contained in:
parent
8e89816099
commit
bbcbbaf3b1
5 changed files with 49 additions and 42 deletions
|
@ -98,7 +98,7 @@ func (r *router) insertPeer(from phony.IActor, info *dhtInfo) {
|
|||
// Reset sessions and DHT after the switch sees our coords change
|
||||
func (r *router) reset(from phony.IActor) {
|
||||
r.EnqueueFrom(from, func() {
|
||||
r.core.sessions.reset()
|
||||
r.core.sessions.reset(r)
|
||||
r.core.dht.reset()
|
||||
})
|
||||
}
|
||||
|
@ -111,14 +111,14 @@ func (r *router) _mainLoop() {
|
|||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
r.SyncExec(func() {
|
||||
<-r.SyncExec(func() {
|
||||
// Any periodic maintenance stuff goes here
|
||||
r.core.switchTable.doMaintenance()
|
||||
r.core.dht.doMaintenance()
|
||||
r.core.sessions.cleanup()
|
||||
})
|
||||
case e := <-r.reconfigure:
|
||||
r.SyncExec(func() {
|
||||
<-r.SyncExec(func() {
|
||||
current := r.core.config.GetCurrent()
|
||||
e <- r.nodeinfo.setNodeInfo(current.NodeInfo, current.NodeInfoPrivacy)
|
||||
})
|
||||
|
@ -252,5 +252,5 @@ func (r *router) _handleNodeInfo(bs []byte, fromKey *crypto.BoxPubKey) {
|
|||
|
||||
// TODO remove this, have things either be actors that send message or else call SyncExec directly
|
||||
func (r *router) doAdmin(f func()) {
|
||||
r.SyncExec(f)
|
||||
<-r.SyncExec(f)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue