start migrating the router to an actor

This commit is contained in:
Arceliar 2019-08-23 18:47:15 -05:00
parent 562a7d1f19
commit 9d7e7288c6
8 changed files with 51 additions and 54 deletions

View file

@ -245,10 +245,7 @@ func (t *switchTable) cleanRoot() {
if t.data.locator.root != t.key {
t.data.seq++
t.updater.Store(&sync.Once{})
select {
case t.core.router.reset <- struct{}{}:
default:
}
t.core.router.reset(&t.core.router)
}
t.data.locator = switchLocator{root: t.key, tstamp: now.Unix()}
t.core.peers.sendSwitchMsgs()
@ -511,10 +508,7 @@ func (t *switchTable) unlockedHandleMsg(msg *switchMsg, fromPort switchPort, rep
if !equiv(&sender.locator, &t.data.locator) {
doUpdate = true
t.data.seq++
select {
case t.core.router.reset <- struct{}{}:
default:
}
t.core.router.reset(&t.core.router)
}
if t.data.locator.tstamp != sender.locator.tstamp {
t.time = now