From 1033f5aa67c06c6896576701322ff6064b7a5eec Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Sun, 25 Apr 2021 21:50:22 +0800 Subject: [PATCH] fix doc comments --- actix-server/src/accept.rs | 7 +++---- actix-server/src/waker.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/actix-server/src/accept.rs b/actix-server/src/accept.rs index 405f0a9f..7d35460d 100644 --- a/actix-server/src/accept.rs +++ b/actix-server/src/accept.rs @@ -244,7 +244,6 @@ impl Accept { } } _ => { - println!("polling event"); let token = usize::from(token); self.accept(token); } @@ -342,8 +341,8 @@ impl Accept { let next = self.next(); match next.send(conn) { Ok(_) => { - // Increment counter of WorkerHandle. - // Set worker to unavailable with it hit max (Return false). + // Increment counter of worker handle. + // Set it to unavailable with it hit max (Return false). if !next.incr_counter() { let idx = next.idx(); self.avail.set_available(idx, false); @@ -357,7 +356,7 @@ impl Accept { self.remove_next(); if self.handles.is_empty() { - error!("No workers"); + error!("No worker available. Dropping connection."); // All workers are gone and Conn is nowhere to be sent. // Treat this situation as Ok and drop Conn. return Ok(()); diff --git a/actix-server/src/waker.rs b/actix-server/src/waker.rs index 34178764..b47cc3fb 100644 --- a/actix-server/src/waker.rs +++ b/actix-server/src/waker.rs @@ -12,7 +12,7 @@ use crate::worker::WorkerHandleAccept; /// Waker token for `mio::Poll` instance. pub(crate) const WAKER_TOKEN: Token = Token(usize::MAX); -/// Types of interests we would look into when `Accept`'s `Poll` is waked up by waker. +/// Types of interests we would look into when `Accept`'s `Poll` is waked up by WakerTx. /// /// These interests should not be confused with `mio::Interest` and mostly not I/O related pub(crate) enum WakerInterest { @@ -55,11 +55,11 @@ impl Clone for WakerTx { } impl WakerTx { - /// Send WakerInterest through channel and panic on error(shutdown). pub(crate) fn wake(&self, interest: WakerInterest) { - // ingore result. tokio UnboundedSender only fail when the channel - // is closed. In that case the Accept thread is gone and no further - // wake up is needed/possible. + // ingore result. tokio UnboundedSender::send only fail when the + // channel is closed. + // In that case the Accept thread is gone and no further wake up + // is needed/possible. let _ = self.0.send(interest); } } @@ -82,7 +82,7 @@ impl DerefMut for WakerRx { } pub(crate) fn from_registry(registry: &Registry) -> std::io::Result { - mio::Waker::new(registry, WAKER_TOKEN).map(|waker| Arc::new(_Waker(waker)).into()) + mio::Waker::new(registry, WAKER_TOKEN).map(|waker| Waker::from(Arc::new(_Waker(waker)))) } pub(crate) fn waker_channel() -> (WakerTx, WakerRx) {