mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-27 19:12:56 +01:00
remove unnecessary Pin in poll_recv calls (#475)
This commit is contained in:
parent
d973d5974a
commit
dde38bbe06
@ -303,7 +303,7 @@ impl Future for ArbiterRunner {
|
|||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
// process all items currently buffered in channel
|
// process all items currently buffered in channel
|
||||||
loop {
|
loop {
|
||||||
match ready!(Pin::new(&mut self.rx).poll_recv(cx)) {
|
match ready!(self.rx.poll_recv(cx)) {
|
||||||
// channel closed; no more messages can be received
|
// channel closed; no more messages can be received
|
||||||
None => return Poll::Ready(()),
|
None => return Poll::Ready(()),
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ impl Future for SystemController {
|
|||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
// process all items currently buffered in channel
|
// process all items currently buffered in channel
|
||||||
loop {
|
loop {
|
||||||
match ready!(Pin::new(&mut self.cmd_rx).poll_recv(cx)) {
|
match ready!(self.cmd_rx.poll_recv(cx)) {
|
||||||
// channel closed; no more messages can be received
|
// channel closed; no more messages can be received
|
||||||
None => return Poll::Ready(()),
|
None => return Poll::Ready(()),
|
||||||
|
|
||||||
|
@ -363,6 +363,6 @@ impl Stream for ServerEventMultiplexer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pin::new(&mut this.cmd_rx).poll_recv(cx)
|
this.cmd_rx.poll_recv(cx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ impl Future for Signals {
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
for (sig, fut) in self.signals.iter_mut() {
|
for (sig, fut) in self.signals.iter_mut() {
|
||||||
if Pin::new(fut).poll_recv(cx).is_ready() {
|
if fut.poll_recv(cx).is_ready() {
|
||||||
trace!("{} received", sig);
|
trace!("{} received", sig);
|
||||||
return Poll::Ready(*sig);
|
return Poll::Ready(*sig);
|
||||||
}
|
}
|
||||||
|
@ -585,9 +585,7 @@ impl Future for ServerWorker {
|
|||||||
let this = self.as_mut().get_mut();
|
let this = self.as_mut().get_mut();
|
||||||
|
|
||||||
// `StopWorker` message handler
|
// `StopWorker` message handler
|
||||||
if let Poll::Ready(Some(Stop { graceful, tx })) =
|
if let Poll::Ready(Some(Stop { graceful, tx })) = this.stop_rx.poll_recv(cx) {
|
||||||
Pin::new(&mut this.stop_rx).poll_recv(cx)
|
|
||||||
{
|
|
||||||
let num = this.counter.total();
|
let num = this.counter.total();
|
||||||
if num == 0 {
|
if num == 0 {
|
||||||
info!("shutting down idle worker");
|
info!("shutting down idle worker");
|
||||||
@ -649,7 +647,7 @@ impl Future for ServerWorker {
|
|||||||
}
|
}
|
||||||
WorkerState::Shutdown(ref mut shutdown) => {
|
WorkerState::Shutdown(ref mut shutdown) => {
|
||||||
// drop all pending connections in rx channel.
|
// drop all pending connections in rx channel.
|
||||||
while let Poll::Ready(Some(conn)) = Pin::new(&mut this.conn_rx).poll_recv(cx) {
|
while let Poll::Ready(Some(conn)) = this.conn_rx.poll_recv(cx) {
|
||||||
// WorkerCounterGuard is needed as Accept thread has incremented counter.
|
// WorkerCounterGuard is needed as Accept thread has incremented counter.
|
||||||
// It's guard's job to decrement the counter together with drop of Conn.
|
// It's guard's job to decrement the counter together with drop of Conn.
|
||||||
let guard = this.counter.guard();
|
let guard = this.counter.guard();
|
||||||
@ -696,7 +694,7 @@ impl Future for ServerWorker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle incoming io stream
|
// handle incoming io stream
|
||||||
match ready!(Pin::new(&mut this.conn_rx).poll_recv(cx)) {
|
match ready!(this.conn_rx.poll_recv(cx)) {
|
||||||
Some(msg) => {
|
Some(msg) => {
|
||||||
let guard = this.counter.guard();
|
let guard = this.counter.guard();
|
||||||
let _ = this.services[msg.token].service.call((guard, msg.io));
|
let _ = this.services[msg.token].service.call((guard, msg.io));
|
||||||
|
Loading…
Reference in New Issue
Block a user