mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-09 23:20:28 +00:00
Formatting
This commit is contained in:
parent
483d90a728
commit
8ef852469b
@ -73,20 +73,22 @@ func (a *admin) handleRequest(conn net.Conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Look up everything we know from DHT
|
// Look up everything we know from DHT
|
||||||
for i := 0; i < a.core.dht.nBuckets(); i++ {
|
for i := 0; i < a.core.dht.nBuckets(); i++ {
|
||||||
b := a.core.dht.getBucket(i)
|
b := a.core.dht.getBucket(i)
|
||||||
for _, v := range b.infos {
|
for _, v := range b.infos {
|
||||||
var destPorts []switchPort
|
var destPorts []switchPort
|
||||||
for offset := 0 ; ; {
|
for offset := 0; ; {
|
||||||
coord, length := wire_decode_uint64(v.coords[offset:])
|
coord, length := wire_decode_uint64(v.coords[offset:])
|
||||||
if length == 0 { break }
|
if length == 0 {
|
||||||
destPorts = append(destPorts, switchPort(coord))
|
break
|
||||||
offset += length
|
}
|
||||||
}
|
destPorts = append(destPorts, switchPort(coord))
|
||||||
addr := net.IP(address_addrForNodeID(v.nodeID_hidden)[:]).String()
|
offset += length
|
||||||
var index [mDepth]switchPort
|
}
|
||||||
copy(index[:mDepth], destPorts[:])
|
addr := net.IP(address_addrForNodeID(v.nodeID_hidden)[:]).String()
|
||||||
m[index] = addr
|
var index [mDepth]switchPort
|
||||||
|
copy(index[:mDepth], destPorts[:])
|
||||||
|
m[index] = addr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,15 +99,15 @@ func (a *admin) handleRequest(conn net.Conn) {
|
|||||||
copy(mask[:mDepth], k[:])
|
copy(mask[:mDepth], k[:])
|
||||||
for mk := range mask {
|
for mk := range mask {
|
||||||
mask[len(mask)-1-mk] = 0
|
mask[len(mask)-1-mk] = 0
|
||||||
if len(m[k]) == 0 {
|
if len(m[k]) == 0 {
|
||||||
m[k] = fmt.Sprintf("%+v (missing)", k)
|
m[k] = fmt.Sprintf("%+v (missing)", k)
|
||||||
}
|
}
|
||||||
if len(m[mask]) == 0 {
|
if len(m[mask]) == 0 {
|
||||||
m[mask] = fmt.Sprintf("%+v (missing)", mask)
|
m[mask] = fmt.Sprintf("%+v (missing)", mask)
|
||||||
}
|
}
|
||||||
if len(m[mask]) > 0 && m[mask] != m[k] {
|
if len(m[mask]) > 0 && m[mask] != m[k] {
|
||||||
conn.Write([]byte(fmt.Sprintf(" \"%+v\" -- \"%+v\";\n", m[k], m[mask])))
|
conn.Write([]byte(fmt.Sprintf(" \"%+v\" -- \"%+v\";\n", m[k], m[mask])))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user