mirror of https://github.com/fafhrd91/actix-net
Add note for field order of ServerWorker
This commit is contained in:
parent
b18dd4b05f
commit
6c18af80f0
|
@ -125,6 +125,8 @@ impl WorkerAvailability {
|
||||||
///
|
///
|
||||||
/// Worker accepts Socket objects via unbounded channel and starts stream processing.
|
/// Worker accepts Socket objects via unbounded channel and starts stream processing.
|
||||||
pub(crate) struct ServerWorker {
|
pub(crate) struct ServerWorker {
|
||||||
|
// UnboundedReceiver<Conn> should always the first field.
|
||||||
|
// It must be dropped as soon as ServerWorker dropping.
|
||||||
rx: UnboundedReceiver<Conn>,
|
rx: UnboundedReceiver<Conn>,
|
||||||
rx2: UnboundedReceiver<Stop>,
|
rx2: UnboundedReceiver<Stop>,
|
||||||
services: Box<[WorkerService]>,
|
services: Box<[WorkerService]>,
|
||||||
|
@ -370,9 +372,7 @@ impl Default for WorkerState {
|
||||||
|
|
||||||
impl Drop for ServerWorker {
|
impl Drop for ServerWorker {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
/// Close channel on drop.
|
// Stop Arbiter Self runs on on drop.
|
||||||
self.rx.close();
|
|
||||||
/// Stop Arbiter Self runs on on drop.
|
|
||||||
Arbiter::current().stop();
|
Arbiter::current().stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue