Merge pull request #5 from neilalexander/master

Highlight own node on dot graph
This commit is contained in:
Arceliar 2018-01-21 15:57:26 -06:00 committed by GitHub
commit 73cc6b5ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,10 +54,10 @@ func (a *admin) handleRequest(conn net.Conn) {
// Add my own entry
peerID := address_addrForNodeID(getNodeID(&peers[0].box))
addr := net.IP(peerID[:]).String()
myAddr := net.IP(peerID[:]).String()
var index [mDepth]switchPort
copy(index[:mDepth], table.self.coords[:])
m[index] = addr
m[index] = myAddr
// Connect switch table entries to peer entries
for _, tableentry := range table.elems {
@ -157,8 +157,12 @@ func (a *admin) handleRequest(conn net.Conn) {
conn.Write([]byte(fmt.Sprintf("digraph {\n")))
// First set the labels
for _, info := range infos {
if info.name == myAddr {
conn.Write([]byte(fmt.Sprintf("\"%v\" [ style = \"filled\", label = \"%v\" ];\n", info.key, info.name)))
} else {
conn.Write([]byte(fmt.Sprintf("\"%v\" [ label = \"%v\" ];\n", info.key, info.name)))
}
}
// Then print the tree structure
for _, info := range infos {
if info.key == info.parent {