Skip to content

Commit 3c1f577

Browse files
authored
Make ServerWorker drop stop Arbiter it runs on (#334)
1 parent d49ecf7 commit 3c1f577

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

actix-server/src/worker.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,12 @@ impl Default for WorkerState {
368368
}
369369
}
370370

371+
impl Drop for ServerWorker {
372+
fn drop(&mut self) {
373+
Arbiter::current().stop();
374+
}
375+
}
376+
371377
impl Future for ServerWorker {
372378
type Output = ();
373379

@@ -451,14 +457,12 @@ impl Future for ServerWorker {
451457
if let WorkerState::Shutdown(shutdown) = mem::take(&mut this.state) {
452458
let _ = shutdown.tx.send(true);
453459
}
454-
Arbiter::current().stop();
455460
Poll::Ready(())
456461
} else if shutdown.start_from.elapsed() >= this.shutdown_timeout {
457462
// Timeout forceful shutdown.
458463
if let WorkerState::Shutdown(shutdown) = mem::take(&mut this.state) {
459464
let _ = shutdown.tx.send(false);
460465
}
461-
Arbiter::current().stop();
462466
Poll::Ready(())
463467
} else {
464468
// Reset timer and wait for 1 second.

0 commit comments

Comments
 (0)