Closed polachok closed 7 years ago
While I agree this issue is must be done, although I have three concerns.
Probably you are exposing low level of it (which is inconvenient for users and makes it hard to maintain backward compatibility). Probably, ServerBuilder
(or better httpbis::ServerBuilder
) should have a field Option<reactor::Handle>
(or reactor::Remote
))
It is interesting, how other projects based on tokio solve the issue.
Test needs to be included, to avoid accidental breakage.
1.I don't quite understand how to make Server/ServerBuilder work with existing event loop 2.Hyper has Http::bind() which returns new server on a new loop and Http::new().bind_connection(handle: &Handle, io: I, remote_addr: SocketAddr, service: S) to use the same way I propose.
I've added ServerBuilder::event_loop
option to use external event loop: https://github.com/stepancheg/rust-http2/commit/331841802824b57c4bb8a1b03d75ba796270880a.
If that doesn't work, please reopen the issue.
Makes it possible to use external event loop and server, like this: