Skip to content

Commit

Permalink
Mark ourself as connected (ava-labs#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored and oxbee committed Nov 6, 2024
1 parent 2290a4f commit 2082b5a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions peer/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,11 @@ func (n *network) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion
return nil
}

if nodeID == n.self {
log.Debug("skipping registering self as peer")
return nil
if nodeID != n.self {
// The legacy peer tracker doesn't expect to be connected to itself.
n.peers.Connected(nodeID, nodeVersion)
}

n.peers.Connected(nodeID, nodeVersion)
return n.p2pNetwork.Connected(ctx, nodeID, nodeVersion)
}

Expand All @@ -524,7 +523,11 @@ func (n *network) Disconnected(ctx context.Context, nodeID ids.NodeID) error {
return nil
}

n.peers.Disconnected(nodeID)
if nodeID != n.self {
// The legacy peer tracker doesn't expect to be connected to itself.
n.peers.Disconnected(nodeID)
}

return n.p2pNetwork.Disconnected(ctx, nodeID)
}

Expand Down

0 comments on commit 2082b5a

Please sign in to comment.