mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-27 12:05:23 +00:00
more switch fixes
This commit is contained in:
parent
8775075c18
commit
5e170e22e1
@ -392,6 +392,9 @@ func (t *switchTable) _handleMsg(msg *switchMsg, fromPort switchPort, reprocessi
|
|||||||
sender.key = prevKey
|
sender.key = prevKey
|
||||||
prevKey = hop.Next
|
prevKey = hop.Next
|
||||||
}
|
}
|
||||||
|
if sender.key == t.key {
|
||||||
|
return // Don't peer with ourself via different interfaces
|
||||||
|
}
|
||||||
sender.msg = *msg
|
sender.msg = *msg
|
||||||
sender.port = fromPort
|
sender.port = fromPort
|
||||||
sender.time = now
|
sender.time = now
|
||||||
@ -516,8 +519,8 @@ func (t *switchTable) _handleMsg(msg *switchMsg, fromPort switchPort, reprocessi
|
|||||||
}
|
}
|
||||||
// Note that we depend on the LIFO order of the stack of defers here...
|
// Note that we depend on the LIFO order of the stack of defers here...
|
||||||
if updateRoot {
|
if updateRoot {
|
||||||
|
doUpdate = true
|
||||||
if !equiv(&sender.locator, &t.data.locator) {
|
if !equiv(&sender.locator, &t.data.locator) {
|
||||||
doUpdate = true
|
|
||||||
t.data.seq++
|
t.data.seq++
|
||||||
defer t.core.router.reset(t)
|
defer t.core.router.reset(t)
|
||||||
}
|
}
|
||||||
@ -528,8 +531,8 @@ func (t *switchTable) _handleMsg(msg *switchMsg, fromPort switchPort, reprocessi
|
|||||||
t.parent = sender.port
|
t.parent = sender.port
|
||||||
defer t.core.peers.sendSwitchMsgs(t)
|
defer t.core.peers.sendSwitchMsgs(t)
|
||||||
}
|
}
|
||||||
if true || doUpdate {
|
if doUpdate {
|
||||||
defer t._updateTable()
|
t._updateTable()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -546,9 +549,7 @@ func (t *switchTable) _updateTable() {
|
|||||||
}
|
}
|
||||||
newTable._init()
|
newTable._init()
|
||||||
for _, pinfo := range t.data.peers {
|
for _, pinfo := range t.data.peers {
|
||||||
if pinfo.blocked ||
|
if pinfo.blocked || pinfo.locator.root != newTable.self.root {
|
||||||
pinfo.locator.root != newTable.self.root ||
|
|
||||||
pinfo.key == t.key {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
loc := pinfo.locator.clone()
|
loc := pinfo.locator.clone()
|
||||||
|
Loading…
Reference in New Issue
Block a user