Skip to content

Commit

Permalink
apply feedback and skip self
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcarle committed May 10, 2023
1 parent c3b21c2 commit 479f1d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,18 @@ func (p *Peer) Start() error {

// reconnect to known peers
for _, id := range p.host.Peerstore().PeersWithAddrs() {
if id == p.host.ID() {
continue
}
go func(id peer.ID) {
addr := p.host.Peerstore().PeerInfo(id)
err := p.host.Connect(p.ctx, addr)
if err != nil {
log.Info(
p.ctx,
"Failed to reconnect to peer`",
"Failure while reconnecting to a known peer",
logging.NewKV("peer", id),
logging.NewKV("error", err),
)
}
}(id)
Expand Down

0 comments on commit 479f1d7

Please sign in to comment.