From 58a67ade328a1eb8a5d869b41c2f03c4f562a241 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 15 Nov 2021 02:33:13 +0000 Subject: [PATCH] improve docs of system_exit --- actix-server/src/builder.rs | 2 +- actix-server/src/handle.rs | 2 ++ actix-server/src/server.rs | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index dbf00303..4f4d6e26 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -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 diff --git a/actix-server/src/handle.rs b/actix-server/src/handle.rs index 49d8eb01..53f00bee 100644 --- a/actix-server/src/handle.rs +++ b/actix-server/src/handle.rs @@ -42,10 +42,12 @@ impl ServerHandle { /// Stop incoming connection processing, stop all workers and exit. pub fn stop(&self, graceful: bool) -> impl Future { let (tx, rx) = oneshot::channel(); + let _ = self.cmd_tx.send(ServerCommand::Stop { graceful, completion: Some(tx), }); + async { let _ = rx.await; } diff --git a/actix-server/src/server.rs b/actix-server/src/server.rs index 9611062a..08036eeb 100644 --- a/actix-server/src/server.rs +++ b/actix-server/src/server.rs @@ -196,11 +196,11 @@ impl Future for Server { fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { 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) {