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(identify): immediately run identify protocol on new connections #3545

Merged
merged 22 commits into from
May 2, 2023

Conversation

PopBogdan97
Copy link
Contributor

@PopBogdan97 PopBogdan97 commented Mar 3, 2023

Description

Previously, and for unknown legacy reasons, we waited for a configurable delay (default 500ms) upon new connections before we ran the identify protocol. This unnecessarily slows down applications that wait for the identify handshake to complete before performing further actions.

Resolves #3485.

Notes

Please check if the description in the deprecation notes is correct.

Links to any relevant issues

Related issue #3485

Open Questions

@thomaseizinger @mxinden In the related issues #3485 you mentioned also removing completely the initial delay, but here

let protocol = Behaviour::new(
Config::new("a".to_string(), pubkey.clone())
// `swarm1` will set `KeepAlive::No` once it identified `swarm2` and thus
// closes the connection. At this point in time `swarm2` might not yet have
// identified `swarm1`. To give `swarm2` enough time, set an initial delay on
// `swarm1`.
.with_initial_delay(Duration::from_secs(10)),
);
it seems to be needed. Should I just reduce the delay without making it deprecated?

Please let me know if you have any comments on the PR, as I am still a beginner in contributing to open source software any comment is valuable for me :)

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

@PopBogdan97 PopBogdan97 marked this pull request as ready for review March 7, 2023 09:45
mxinden
mxinden previously approved these changes Mar 7, 2023
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Change looks good to me. Will give @thomaseizinger a chance to review as well.

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.

Couple of comments, otherwise LGTM.

I think technically, a deprecation should not change behaviour. I don't mind in this case though as I think there is no harm in removing the delay.

@mergify
Copy link
Contributor

mergify bot commented Mar 8, 2023

This pull request has merge conflicts. Could you please resolve them @PopBogdan97? 🙏

@mergify
Copy link
Contributor

mergify bot commented Mar 10, 2023

This pull request has merge conflicts. Could you please resolve them @PopBogdan97? 🙏

@thomaseizinger thomaseizinger changed the title feat(identify): Remove initial delay on the identify protocol feat(identify): remove initial delay on the identify protocol Mar 11, 2023
@thomaseizinger thomaseizinger changed the title feat(identify): remove initial delay on the identify protocol feat(identify): remove initial delay for the identify protocol Mar 11, 2023
@thomaseizinger thomaseizinger changed the title feat(identify): remove initial delay for the identify protocol feat(identify): immediately run identify protocol on new connections Mar 11, 2023
@thomaseizinger
Copy link
Contributor

@mxinden What should we do about the test that is mentioned in the PR description? I think we should be able to work around that by perhaps adding the KeepAlive behaviour?

@thomaseizinger
Copy link
Contributor

thomaseizinger commented Mar 20, 2023

You'll need to sprinkle some #[allow(deprecated)] attributes to make CI pass.

@mxinden
Copy link
Member

mxinden commented Mar 29, 2023

I think we should be able to work around that by perhaps adding the KeepAlive behaviour?

Sounds good. I am also fine with merging here without a dedicated test. I consider this pull request removing functionality (that is the delay) instead of adding functionality.

thomaseizinger
thomaseizinger previously approved these changes Mar 29, 2023
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.

ACK with nits

@mxinden
Copy link
Member

mxinden commented Apr 17, 2023

Friendly ping @PopBogdan97.

@PopBogdan97
Copy link
Contributor Author

Friendly ping @PopBogdan97.

Sorry for the delay, I had some issues, I will commit the last changes ASAP.

thomaseizinger
thomaseizinger previously approved these changes May 2, 2023
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.

Awesome, thanks!

@PopBogdan97
Copy link
Contributor Author

Awesome, thanks!

No problem, sorry for the delay

@mergify

This comment was marked as resolved.

@mergify mergify bot merged commit f858ec6 into libp2p:master May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

identify: remove initial delay
3 participants