⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@gacevicljubisa
Copy link
Member

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

refactor(libp2p): use precise connection cleanup in handshake error handling

Replace ClosePeer() with Conn().Close() for connection-specific errors
during handshake. ClosePeer() terminates all connections to a peer,
while Conn().Close() only closes the specific failed connection.

This prevents disrupting healthy concurrent connections and improves
handling of duplicate connection attempts by preserving existing
sessions when rejecting new redundant connections.

Changes:

  • Use stream.Conn().Close() instead of ClosePeer() in handshake error paths
  • Improve duplicate peer handling to only close the new connection
  • Add clarifying comment for duplicate connection scenario

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

Copy link
Member

@janos janos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants