fix doc comments

This commit is contained in:
fakeshadow 2021-04-25 21:50:22 +08:00
parent a19cc228aa
commit 1033f5aa67
2 changed files with 9 additions and 10 deletions

View File

@ -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(());

View File

@ -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<Waker> {
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) {