Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@libp2p/tcp): race condition in onSocket #2763

Merged
merged 5 commits into from
Oct 23, 2024

Commits on Oct 11, 2024

  1. fix(@libp2p/tcp): race condition in onSocket

    This fixes a race condition in the onSocket listener method.
    onSocket gets a net.Socket parameter that needs to be closed later
    before the tcp server can close.
    The net.Socket is used to create a MultiaddrConnection but the
    connection is not tracked with this.connections until after it has been
    upgraded.
    If the tcp listener.close is called while a the MultiaddrConnection is waiting
    to be upgraded, then the MultiaddrConnection socket cannot be closed as
    it does not exist in this.connections.
    
    Instead of adding the MultiaddrConnection to this.connections on
    creation I decided to create a separate property named
    this.maConnections. I decided to track the non-upgraded connections
    separately because I was unsure how this.connections must be used with other things
    like metrics.
    tabcat committed Oct 11, 2024
    Configuration menu
    Copy the full SHA
    c441230 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f3cf019 View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2024

  1. Configuration menu
    Copy the full SHA
    00f9233 View commit details
    Browse the repository at this point in the history
  2. chore: simplify test

    achingbrain committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    f023585 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c8e19cb View commit details
    Browse the repository at this point in the history