1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-12-02 18:52:22 +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) self.max_concurrent_connections(num)
} }
/// Stop Actix system. /// Stop Actix `System` after server shutdown.
pub fn system_exit(mut self) -> Self { pub fn system_exit(mut self) -> Self {
self.exit = true; self.exit = true;
self self

View File

@ -42,10 +42,12 @@ impl ServerHandle {
/// Stop incoming connection processing, stop all workers and exit. /// Stop incoming connection processing, stop all workers and exit.
pub fn stop(&self, graceful: bool) -> impl Future<Output = ()> { pub fn stop(&self, graceful: bool) -> impl Future<Output = ()> {
let (tx, rx) = oneshot::channel(); let (tx, rx) = oneshot::channel();
let _ = self.cmd_tx.send(ServerCommand::Stop { let _ = self.cmd_tx.send(ServerCommand::Stop {
graceful, graceful,
completion: Some(tx), completion: Some(tx),
}); });
async { async {
let _ = rx.await; 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> { fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
match self.as_mut().get_mut() { match self.as_mut().get_mut() {
Server::Error(err) => Poll::Ready(Err(err Self::Error(err) => Poll::Ready(Err(err
.take() .take()
.expect("Server future cannot be polled after error"))), .expect("Server future cannot be polled after error"))),
Server::Server(inner) => { Self::Server(inner) => {
// poll Signals // poll Signals
if let Some(ref mut signals) = inner.signals { if let Some(ref mut signals) = inner.signals {
if let Poll::Ready(signal) = Pin::new(signals).poll(cx) { if let Poll::Ready(signal) = Pin::new(signals).poll(cx) {