mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
move special peer/dht insert logic form router.go to dht.go
This commit is contained in:
parent
e65910806c
commit
dfcdafa55c
2 changed files with 10 additions and 6 deletions
|
@ -110,12 +110,7 @@ func (r *router) mainLoop() {
|
|||
case p := <-r.send:
|
||||
r.sendPacket(p)
|
||||
case info := <-r.core.dht.peers:
|
||||
now := time.Now()
|
||||
oldInfo, isIn := r.core.dht.table[*info.getNodeID()]
|
||||
r.core.dht.insert(info)
|
||||
if isIn && now.Sub(oldInfo.recv) < 45*time.Second {
|
||||
info.recv = oldInfo.recv
|
||||
}
|
||||
r.core.dht.insertPeer(info)
|
||||
case <-r.reset:
|
||||
r.core.sessions.resetInits()
|
||||
r.core.dht.reset()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue