-
Notifications
You must be signed in to change notification settings - Fork 172
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
Feature request: expose an access to http server handle #547
Comments
Ok, I see you make a good point. Right, you need to keep the stop handle somewhere otherwise it will shutdown when it's dropped that might be annoying yes.
I don't get what you mean by private you can just await on the if let Ok(stop) = server.stop() {
stop.await.unwrap();
}
Sounds like a good idea to me, it was done this to have a "uniform API" with WsServer but perhaps we can change both. |
I mean the underlying join handle could be used for running the server forever, but it's private (which totally makes sense). In your example, at this point handle is only returned after sending the shutdown signal.
I could submit a PR if the proposal gets approved |
Call to
HttpServer::start
consumes the server, spawns a task and gives you aStopHandle
.As far as I see it, there's no easy way to simply "run forever"?
tokio
join handle is private,StopHandle
doesn't implementFuture
, probably I miss something, but this looks a little bit inconvenient.I'd propose to rename
StopHandle
intoServerHandle
and make it awaitable the same way it works in actix:HttpServer::run
returnsServer
which can be used tostop
the server or can be awaited on to run the application forever (since it implementsFuture
).The text was updated successfully, but these errors were encountered: