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

feat(holepunch): add logging when DirectConnect execution fails #3146

Merged
merged 4 commits into from
Feb 3, 2025

Conversation

wlynxg
Copy link
Contributor

@wlynxg wlynxg commented Jan 21, 2025

No description provided.

@sukunrt
Copy link
Member

sukunrt commented Jan 21, 2025

There's already some logging within DirectConnect method. Have you found this specific log useful?

@wlynxg
Copy link
Contributor Author

wlynxg commented Jan 21, 2025

In beginDirectConnect, ErrHolePunchActive will be returned for a connection that is already hole punching. This error is not logged. I hope to observe this error when I observe hole drilling behavior

@wlynxg
Copy link
Contributor Author

wlynxg commented Jan 21, 2025

On the other hand, we can't always rely on internal functions to print all errors once. Since DirectConnect is the outermost interface exposed, it seems to be a better solution to make a general print record of missed errors here (even if it may repeatedly print the error log that has been printed internally).

Copy link
Collaborator

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

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

It's generally a worse pattern to log an error and then return. This was likely left after some debugging. It's better to return the error and let the parent that handles the error decide to log it.

@MarcoPolo MarcoPolo merged commit 8deaed7 into libp2p:master Feb 3, 2025
9 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.

3 participants