Skip to content
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