Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Why is Http<OtherExecutor> not supported #27

Closed
hicqu opened this issue May 5, 2019 · 7 comments
Closed

Why is Http<OtherExecutor> not supported #27

hicqu opened this issue May 5, 2019 · 7 comments

Comments

@hicqu
Copy link

hicqu commented May 5, 2019

I'm confused why Http<DefaultExecutor> is the only choise in Server::serve_with. Is there any special reasons to forbid Http<tokio_threadpool::Sender>?

@LucioFranco
Copy link
Member

hi @hicqu!

Yeah, this is a limitation due to the fact that hyper does not expose its H2Exec trait and Exec enum. Here is the related issue. I am going to revert the change that added the Serve future to just use a Box<Future> for now since this will allow us to erase and punt on the bounds for the executor. This should enable you to use any executor.

Let me know if there is any issue with this.

@LucioFranco
Copy link
Member

PR is up at #28

@hicqu
Copy link
Author

hicqu commented May 6, 2019

Thank you. It can be closed now.

@hicqu hicqu closed this as completed May 6, 2019
@hicqu
Copy link
Author

hicqu commented May 6, 2019

Hi, sorry for closing this issue without try your fix. After tried it I found that hyper::common::server::Exec is private, so I can't call http.with_executor(Exec::executor(...)) to use a tokio pool as the executor. However I can call a deprecated function http.executor(any_my_executor) to associate my executor to the server. Could you show me the best solution?

@hicqu hicqu reopened this May 6, 2019
@LucioFranco
Copy link
Member

@hicqu this is a good question...I'm not totally sure but this seems more appropriate to make an issue in the hyper repo?

That said, you might be able to satisfy this bound to get it to work? https://github.com/hyperium/hyper/blob/master/src/common/exec.rs#L116

@LucioFranco
Copy link
Member

@hicqu can this be closed or are you still seeing issues?

@hicqu
Copy link
Author

hicqu commented May 9, 2019

It can be closed. Thank you!

@hicqu hicqu closed this as completed May 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants