mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-25 13:51:35 +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
|
||||
for i := 0; i < a.core.dht.nBuckets(); i++ {
|
||||
for i := 0; i < a.core.dht.nBuckets(); i++ {
|
||||
b := a.core.dht.getBucket(i)
|
||||
for _, v := range b.infos {
|
||||
var destPorts []switchPort
|
||||
for offset := 0 ; ; {
|
||||
coord, length := wire_decode_uint64(v.coords[offset:])
|
||||
if length == 0 { break }
|
||||
destPorts = append(destPorts, switchPort(coord))
|
||||
offset += length
|
||||
}
|
||||
addr := net.IP(address_addrForNodeID(v.nodeID_hidden)[:]).String()
|
||||
var index [mDepth]switchPort
|
||||
copy(index[:mDepth], destPorts[:])
|
||||
m[index] = addr
|
||||
var destPorts []switchPort
|
||||
for offset := 0; ; {
|
||||
coord, length := wire_decode_uint64(v.coords[offset:])
|
||||
if length == 0 {
|
||||
break
|
||||
}
|
||||
destPorts = append(destPorts, switchPort(coord))
|
||||
offset += length
|
||||
}
|
||||
addr := net.IP(address_addrForNodeID(v.nodeID_hidden)[:]).String()
|
||||
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[:])
|
||||
for mk := range mask {
|
||||
mask[len(mask)-1-mk] = 0
|
||||
if len(m[k]) == 0 {
|
||||
m[k] = fmt.Sprintf("%+v (missing)", k)
|
||||
}
|
||||
if len(m[mask]) == 0 {
|
||||
m[mask] = fmt.Sprintf("%+v (missing)", mask)
|
||||
}
|
||||
if len(m[k]) == 0 {
|
||||
m[k] = fmt.Sprintf("%+v (missing)", k)
|
||||
}
|
||||
if len(m[mask]) == 0 {
|
||||
m[mask] = fmt.Sprintf("%+v (missing)", mask)
|
||||
}
|
||||
if len(m[mask]) > 0 && m[mask] != m[k] {
|
||||
conn.Write([]byte(fmt.Sprintf(" \"%+v\" -- \"%+v\";\n", m[k], m[mask])))
|
||||
break
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user