mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-24 00:01:11 +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 {
|
impl Future for ServerWorker {
|
||||||
type Output = ();
|
type Output = ();
|
||||||
|
|
||||||
@ -451,14 +457,12 @@ impl Future for ServerWorker {
|
|||||||
if let WorkerState::Shutdown(shutdown) = mem::take(&mut this.state) {
|
if let WorkerState::Shutdown(shutdown) = mem::take(&mut this.state) {
|
||||||
let _ = shutdown.tx.send(true);
|
let _ = shutdown.tx.send(true);
|
||||||
}
|
}
|
||||||
Arbiter::current().stop();
|
|
||||||
Poll::Ready(())
|
Poll::Ready(())
|
||||||
} else if shutdown.start_from.elapsed() >= this.shutdown_timeout {
|
} else if shutdown.start_from.elapsed() >= this.shutdown_timeout {
|
||||||
// Timeout forceful shutdown.
|
// Timeout forceful shutdown.
|
||||||
if let WorkerState::Shutdown(shutdown) = mem::take(&mut this.state) {
|
if let WorkerState::Shutdown(shutdown) = mem::take(&mut this.state) {
|
||||||
let _ = shutdown.tx.send(false);
|
let _ = shutdown.tx.send(false);
|
||||||
}
|
}
|
||||||
Arbiter::current().stop();
|
|
||||||
Poll::Ready(())
|
Poll::Ready(())
|
||||||
} else {
|
} else {
|
||||||
// Reset timer and wait for 1 second.
|
// Reset timer and wait for 1 second.
|
||||||
|
Loading…
Reference in New Issue
Block a user