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

swarm: record conn metrics only once #3091

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Dec 7, 2024

This causes discrepancy when the connection is closed before being added to the swarm. This happens only in dial_worker loop when adding to the swarm fails. It's nicer to fix this with a once than to ensure that Close is never called twice within the swarm.

Previously, we did something similar here for tcp connection metrics:
https://github.com/libp2p/go-libp2p/pull/2953/files

@sukunrt sukunrt changed the title swarm: update record conn metrics only once swarm: record conn metrics only once Dec 7, 2024
@sukunrt sukunrt force-pushed the sukun/swarm-metrics branch from 5e679d4 to 5a4f640 Compare December 7, 2024 07:35
@sukunrt sukunrt requested a review from MarcoPolo December 7, 2024 07:36
This causes discrepancy when the connection is closed before being
added to the swarm. This happens only in dial_worker loop when adding
to the swarm fails. It's nicer to fix this with a once than to ensure
that Close is never called twice within the swarm.
@sukunrt sukunrt force-pushed the sukun/swarm-metrics branch from 5a4f640 to e1565ad Compare December 7, 2024 07:41
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.

1 participant