Skip to content

Fall back if no tokio executor available #975

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

Merged
merged 3 commits into from
Feb 28, 2019
Merged

Conversation

tomaka
Copy link
Member

@tomaka tomaka commented Feb 26, 2019

If no tokio executor is available, we fall back to executing tasks directly.

This is mostly for #23

@ghost ghost assigned tomaka Feb 26, 2019
@ghost ghost added the in progress label Feb 26, 2019
// We try to use the default executor, but fall back to polling the task manually if
// no executor is available. This makes it possible to use the core in environments
// outside of tokio.
let mut executor = tokio_executor::DefaultExecutor::current();
Copy link
Contributor

@twittner twittner Feb 26, 2019

Choose a reason for hiding this comment

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

How about using the futures::future::Executor trait instead as an additional parameter type when constructing HandledNodesTasks? You could provide an implementation that loops over a set of futures or else users could plug in their own alternatives, including using a tokio executor.

Copy link
Member Author

Choose a reason for hiding this comment

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

We discussed this together, and concluded that it's a change orthogonal to this PR.

@tomaka tomaka merged commit b1d55cc into libp2p:master Feb 28, 2019
@ghost ghost removed the in progress label Feb 28, 2019
@tomaka tomaka deleted the exec-failback branch February 28, 2019 11:48
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