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

protocols/dcutr/examples: Set libp2p-ping to keep conn alive #2679

Closed
wants to merge 1 commit into from

Conversation

mxinden
Copy link
Member

@mxinden mxinden commented May 29, 2022

Description

The example is for testing out the hole punching capabilities only. Thus best to
remove the complexity of connection keep alives via the ping protocol.

Links to any relevant issues

Might make #2609 (comment) easier to debug. //CC @T2JOESl4m2ZpNC

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

The example is for testing out the hole punching capabilities only. Thus best to
remove the complexity of connection keep alives via the ping protocol.
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

I am okay with the change but confused by your PR description.

Thus best to remove the complexity of connection keep alives via the ping protocol.

You are talking about removing but the diff says you are activating keep_alive?

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

Ah, I think it just clicked for me.

I think what is meant is: Keeping a connection alive without ping is complex and by activating ping's keep-alive feature, we remove this complexity.

Copy link
Contributor

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

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

Not sure if I understand this change. How is not keeping the connection alive currently causing additional complexity?
As a listener, we keep a long-lived connection to the relay anyway, and as a dialer we only want to try hole-punching to the target. After the hole-punch we exchange Identify events and I think it makes sense that the connection eventually closes again.
With the keep alive as a dialer we would keep the connection to the relay, and even after both client successfully hole-punched they would still also keep their relayed connection alive. If someone would be using this example as a reference it might cause some unwanted behaviour for them.

@mxinden
Copy link
Member Author

mxinden commented May 31, 2022

With the keep alive as a dialer we would keep the connection to the relay, and even after both client successfully hole-punched they would still also keep their relayed connection alive. If someone would be using this example as a reference it might cause some unwanted behaviour for them.

True, though users seem to be confused that they get a DirectConnectionUpgradeSucceeded followed by a ConnectionClosed.

I don't have a strong opinion here. You have a good point above. As a compromise, how about calling out that one would not use keep_alive(true) in production code?

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