mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
more insertIfNew bugfixes, and add peerOnly to getDHT output (true if a node is in the bucket.peers slice instead of bucket.others--it means they're not regularly pinged, they're only there to make sure DHT lookups include them as a result, for bootstrapping reasons)
This commit is contained in:
parent
fe518f4e3f
commit
ec8fe338d5
2 changed files with 13 additions and 6 deletions
|
@ -344,20 +344,21 @@ func (a *admin) getData_getDHT() []admin_nodeInfo {
|
|||
getDHT := func() {
|
||||
for i := 0; i < a.core.dht.nBuckets(); i++ {
|
||||
b := a.core.dht.getBucket(i)
|
||||
getInfo := func(vs []*dhtInfo) {
|
||||
getInfo := func(vs []*dhtInfo, isPeer bool) {
|
||||
for _, v := range vs {
|
||||
addr := *address_addrForNodeID(v.getNodeID())
|
||||
info := admin_nodeInfo{
|
||||
{"IP", net.IP(addr[:]).String()},
|
||||
{"coords", fmt.Sprint(v.coords)},
|
||||
{"bucket", fmt.Sprint(i)},
|
||||
{"peerOnly", fmt.Sprint(isPeer)},
|
||||
{"lastSeen", fmt.Sprint(now.Sub(v.recv))},
|
||||
}
|
||||
infos = append(infos, info)
|
||||
}
|
||||
}
|
||||
getInfo(b.other)
|
||||
getInfo(b.peers)
|
||||
getInfo(b.other, false)
|
||||
getInfo(b.peers, true)
|
||||
}
|
||||
}
|
||||
a.core.router.doAdmin(getDHT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue