Skip to content

Commit

Permalink
ci: handle shutdown in p2p client peer connect (rollkit#1332)
Browse files Browse the repository at this point in the history
## Overview
This should fix one of the file closed panics

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved error handling in peer-to-peer connection attempts to prevent
logging connection failures when the context error is nil.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
MSevey committed Nov 14, 2023
1 parent 1e9f9e8 commit e21098c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion p2p/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func (c *Client) findPeers(ctx context.Context) error {
// tryConnect attempts to connect to a peer and logs error if necessary
func (c *Client) tryConnect(ctx context.Context, peer peer.AddrInfo) {
err := c.host.Connect(ctx, peer)
if err != nil {
if err != nil && ctx.Err() == nil {
c.logger.Error("failed to connect to peer", "peer", peer, "error", err)
}
}
Expand Down

0 comments on commit e21098c

Please sign in to comment.