5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-25 08:21:36 +00:00

insert a copy when calling dht.insertPeer

This commit is contained in:
Arceliar 2018-12-26 00:18:51 -06:00
parent 13d14b67ab
commit 50ed92d6d2

View File

@ -145,7 +145,8 @@ func (t *dht) insertPeer(info *dhtInfo) {
oldInfo, isIn := t.table[*info.getNodeID()] oldInfo, isIn := t.table[*info.getNodeID()]
if !isIn || time.Since(oldInfo.recv) > dht_max_delay+30*time.Second { if !isIn || time.Since(oldInfo.recv) > dht_max_delay+30*time.Second {
// TODO? also check coords? // TODO? also check coords?
t.insert(info) newInfo := *info // Insert a copy
t.insert(&newInfo)
} }
} }