Skip to content
Snippets Groups Projects
Unverified Commit 660a3c8a authored by Levente Pap's avatar Levente Pap Committed by GitHub
Browse files

Fix #372 Analysis client plugin panic without gossip (#384)

parent f9a8cf20
No related branches found
No related tags found
No related merge requests found
...@@ -88,20 +88,26 @@ func reportHeartbeat(dispatchers *EventDispatchers) { ...@@ -88,20 +88,26 @@ func reportHeartbeat(dispatchers *EventDispatchers) {
nodeID = local.GetInstance().ID().Bytes() nodeID = local.GetInstance().ID().Bytes()
} }
// Get outboundIds (chosen neighbors) var outboundIds [][]byte
outgoingNeighbors := autopeering.Selection.GetOutgoingNeighbors() var inboundIds [][]byte
outboundIds := make([][]byte, len(outgoingNeighbors))
for i, neighbor := range outgoingNeighbors {
// Doesn't copy the ID, take care not to modify underlying bytearray!
outboundIds[i] = neighbor.ID().Bytes()
}
// Get inboundIds (accepted neighbors) // When gossip (and autopeering selection) is enabled, we have neighbors to report
incomingNeighbors := autopeering.Selection.GetIncomingNeighbors() if autopeering.Selection != nil {
inboundIds := make([][]byte, len(incomingNeighbors)) // Get outboundIds (chosen neighbors)
for i, neighbor := range incomingNeighbors { outgoingNeighbors := autopeering.Selection.GetOutgoingNeighbors()
// Doesn't copy the ID, take care not to modify underlying bytearray! outboundIds = make([][]byte, len(outgoingNeighbors))
inboundIds[i] = neighbor.ID().Bytes() for i, neighbor := range outgoingNeighbors {
// Doesn't copy the ID, take care not to modify underlying bytearray!
outboundIds[i] = neighbor.ID().Bytes()
}
// Get inboundIds (accepted neighbors)
incomingNeighbors := autopeering.Selection.GetIncomingNeighbors()
inboundIds = make([][]byte, len(incomingNeighbors))
for i, neighbor := range incomingNeighbors {
// Doesn't copy the ID, take care not to modify underlying bytearray!
inboundIds[i] = neighbor.ID().Bytes()
}
} }
packet := &heartbeat.Packet{OwnID: nodeID, OutboundIDs: outboundIds, InboundIDs: inboundIds} packet := &heartbeat.Packet{OwnID: nodeID, OutboundIDs: outboundIds, InboundIDs: inboundIds}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment