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

*: Remove use of development_transport in examples and tests #3056

Closed
wants to merge 8 commits into from

Conversation

thomaseizinger
Copy link
Contributor

@thomaseizinger thomaseizinger commented Oct 24, 2022

Description

These create circular dependencies to the root libp2p crate in tests.

Links to any relevant issues

Open Questions

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

These create circular dependencies to the root libp2p crate in tests.
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

Hi Thomas, LGTM appart from the tcp::TcpTransport -> tcp::async_io::Transport and tokio on the use-tokio mdns test

protocols/mdns/tests/use-tokio.rs Outdated Show resolved Hide resolved
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

LGTM!

MyBehaviour {
rendezvous: rendezvous::client::Behaviour::new(identity.clone()),
ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(1))),
},
PeerId::from(identity.public()),
);
)
.executor(Box::new(|f| {
Copy link
Member

Choose a reason for hiding this comment

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

Curious Thomas, why do we need it here but not when using tcp::async_io::Tcp ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

async-std implicitly creates a reactor on each thread that an IO component is polled on. tokio only creates a reactor on worker threads and thus requires explicit control over where tasks are spawned.

By default, a Swarm creates a futures::executor::Threadpool for these background tasks and that doesn't work for tokio. Also see #3068.

@jxs
Copy link
Member

jxs commented Oct 27, 2022

just noticed https://github.com/libp2p/rust-libp2p/blob/master/src/tutorials/ping.rs also needs to be addressed

@thomaseizinger thomaseizinger marked this pull request as draft November 2, 2022 04:08
@thomaseizinger
Copy link
Contributor Author

thomaseizinger commented Nov 4, 2022

How should we move forward here? Should I remove the deprecation and just not use those transports for the tests and crate-specific examples? That will break the circular dependencies which is what I am after.

We can then decide separately, what we should rename those transport constructors to.

@mxinden Input please :)

@thomaseizinger thomaseizinger changed the title libp2p: Deprecate development transports *: Remove use of development_transport in examples and tests Nov 13, 2022
@thomaseizinger thomaseizinger marked this pull request as ready for review November 13, 2022 02:10
@thomaseizinger
Copy link
Contributor Author

Closing in favor of #3023.

@thomaseizinger thomaseizinger deleted the 3053-deprecate-development-transport branch November 17, 2022 01:17
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