[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: 0325aad24e
PR: #200
This commit is contained in:
parent
a76df9b9ac
commit
3aac902632
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue