1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 15:42:57 +01:00

improve docs of system_exit

This commit is contained in:
Rob Ede 2021-11-15 02:33:13 +00:00
parent 38caa8f088
commit 58a67ade32
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 5 additions and 3 deletions

View File

@ -113,7 +113,7 @@ impl ServerBuilder {
self.max_concurrent_connections(num)
}
/// Stop Actix system.
/// Stop Actix `System` after server shutdown.
pub fn system_exit(mut self) -> Self {
self.exit = true;
self

View File

@ -42,10 +42,12 @@ impl ServerHandle {
/// Stop incoming connection processing, stop all workers and exit.
pub fn stop(&self, graceful: bool) -> impl Future<Output = ()> {
let (tx, rx) = oneshot::channel();
let _ = self.cmd_tx.send(ServerCommand::Stop {
graceful,
completion: Some(tx),
});
async {
let _ = rx.await;
}

View File

@ -196,11 +196,11 @@ impl Future for Server {
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
match self.as_mut().get_mut() {
Server::Error(err) => Poll::Ready(Err(err
Self::Error(err) => Poll::Ready(Err(err
.take()
.expect("Server future cannot be polled after error"))),
Server::Server(inner) => {
Self::Server(inner) => {
// poll Signals
if let Some(ref mut signals) = inner.signals {
if let Poll::Ready(signal) = Pin::new(signals).poll(cx) {