mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-23 21:51:06 +01:00
Make ServerWorker drop stop Arbiter it runs on (#334)
This commit is contained in:
parent
d49ecf7203
commit
3c1f57706a
@ -368,6 +368,12 @@ impl Default for WorkerState {
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for ServerWorker {
|
||||
fn drop(&mut self) {
|
||||
Arbiter::current().stop();
|
||||
}
|
||||
}
|
||||
|
||||
impl Future for ServerWorker {
|
||||
type Output = ();
|
||||
|
||||
@ -451,14 +457,12 @@ impl Future for ServerWorker {
|
||||
if let WorkerState::Shutdown(shutdown) = mem::take(&mut this.state) {
|
||||
let _ = shutdown.tx.send(true);
|
||||
}
|
||||
Arbiter::current().stop();
|
||||
Poll::Ready(())
|
||||
} else if shutdown.start_from.elapsed() >= this.shutdown_timeout {
|
||||
// Timeout forceful shutdown.
|
||||
if let WorkerState::Shutdown(shutdown) = mem::take(&mut this.state) {
|
||||
let _ = shutdown.tx.send(false);
|
||||
}
|
||||
Arbiter::current().stop();
|
||||
Poll::Ready(())
|
||||
} else {
|
||||
// Reset timer and wait for 1 second.
|
||||
|
Loading…
Reference in New Issue
Block a user