Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove FutureExt::boxed to unify project style #1923

Merged
merged 2 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/common/drain.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::mem;

use futures_util::FutureExt as _;
use tokio_sync::{mpsc, watch};

use super::{Future, Never, Poll, Pin, task};
use futures_util::FutureExt as _;

// Sentinel value signaling that the watch is still open
enum Action {
Expand Down Expand Up @@ -100,9 +100,10 @@ where
loop {
match mem::replace(&mut me.state, State::Draining) {
State::Watch(on_drain) => {
let mut recv_fut = me.watch.rx.recv_ref().boxed();
let recv = me.watch.rx.recv_ref();
futures_util::pin_mut!(recv);

match recv_fut.poll_unpin(cx) {
match recv.poll_unpin(cx) {
Poll::Ready(None) => {
// Drain has been triggered!
on_drain(unsafe { Pin::new_unchecked(&mut me.future) });
Expand Down
5 changes: 3 additions & 2 deletions src/server/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ impl AddrIncoming {
}
self.timeout = None;

let mut accept_fut = self.listener.accept().boxed();
let accept = self.listener.accept();
futures_util::pin_mut!(accept);

loop {
match accept_fut.poll_unpin(cx) {
match accept.poll_unpin(cx) {
Poll::Ready(Ok((socket, addr))) => {
if let Some(dur) = self.tcp_keepalive_timeout {
if let Err(e) = socket.set_keepalive(Some(dur)) {
Expand Down