Skip to content

fix: Ensure tcpGatedMaListener wrapping on both metrics and non-metri… #3275

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

Merged
merged 1 commit into from
May 26, 2025

Conversation

GarmashAlex
Copy link
Contributor

…cs paths

This commit fixes the TCP listener wrapping issue identified in the TODO comment.
Previously, the tcpGatedMaListener was only being applied when metrics were
enabled, but it should be applied consistently on both paths.

The fix ensures that the TCP-specific configurations (such as linger and keepalive
settings) are always applied regardless of whether metrics are enabled, by:

  1. Creating a tcpGatedMaListener wrapper first
  2. Conditionally adding metrics tracing only when enabled
  3. Using the properly wrapped listener in both code paths

This change maintains the same functionality but makes behavior consistent
between metrics-enabled and metrics-disabled configurations, resolving the TODO.

@sukunrt
Copy link
Member

sukunrt commented May 16, 2025

Thanks @GarmashAlex. Apologies for the very late review.

@sukunrt sukunrt merged commit 853011a into libp2p:master May 26, 2025
10 of 11 checks passed
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.

2 participants