From 3aac9026320877a093483f5280d78c4d0de0d80b Mon Sep 17 00:00:00 2001 From: lemoer Date: Sat, 3 Apr 2021 05:11:33 +0200 Subject: [PATCH] [BUG] fix target.hostname of links Before this commit, the value of target.hostname was incorrect. It was accidentially pointing to the hostname of the source of the link. This means target.hostname was equal to source.hostname. Fixes: #197 Fixes: 0325aad24e1cd762c8e7204fa016d4d007a4419d PR: #200 --- runtime/nodes.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/nodes.go b/runtime/nodes.go index f163435..55d871d 100644 --- a/runtime/nodes.go +++ b/runtime/nodes.go @@ -117,7 +117,7 @@ func (nodes *Nodes) NodeLinks(node *Node) (result []Link) { for sourceMAC, batadv := range neighbours.Batadv { for neighbourMAC, link := range batadv.Neighbours { if neighbourID := nodes.ifaceToNodeID[neighbourMAC]; neighbourID != "" { - neighbour := nodes.List[neighbours.NodeID] + neighbour := nodes.List[neighbourID] link := Link{ SourceID: neighbours.NodeID, @@ -128,10 +128,10 @@ func (nodes *Nodes) NodeLinks(node *Node) (result []Link) { } if neighbour.Nodeinfo != nil { - link.SourceHostname = neighbour.Nodeinfo.Hostname + link.TargetHostname = neighbour.Nodeinfo.Hostname } if node.Nodeinfo != nil { - link.TargetHostname = node.Nodeinfo.Hostname + link.SourceHostname = node.Nodeinfo.Hostname } result = append(result, link)