Skip to content

Commit

Permalink
fix: don't try to reconnect to inbound peer addresses (#294)
Browse files Browse the repository at this point in the history
This commit also removes duplicate 'component' tags from various log
lines in the peer governor

Fixes #293
  • Loading branch information
agaffney authored Dec 22, 2024
1 parent 39b22bc commit aae174a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions peergov/peergov.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ func (p *PeerGovernor) createOutboundConnection(peer *Peer) {
peer.Address,
err,
),
"component", "network",
)
if peer.ReconnectDelay == 0 {
peer.ReconnectDelay = initialReconnectDelay
Expand All @@ -211,7 +210,6 @@ func (p *PeerGovernor) createOutboundConnection(peer *Peer) {
peer.ReconnectCount,
peer.Address,
),
"component", "network",
)
time.Sleep(peer.ReconnectDelay)
}
Expand Down Expand Up @@ -250,18 +248,18 @@ func (p *PeerGovernor) handleConnectionClosedEvent(evt event.Event) {
"unexpected connection failure: %s",
e.Error,
),
"component", "network",
"connection_id", e.ConnectionId.String(),
)
} else {
p.config.Logger.Info("connection closed",
"component", "network",
"connection_id", e.ConnectionId.String(),
)
}
peerIdx := p.peerIndexByConnId(e.ConnectionId)
if peerIdx != -1 {
p.peers[peerIdx].ConnectionId = nil
if p.peers[peerIdx].Source != PeerSourceInboundConn {
go p.createOutboundConnection(p.peers[peerIdx])
}
}
go p.createOutboundConnection(p.peers[peerIdx])
}

0 comments on commit aae174a

Please sign in to comment.