refactor(server): work around deprecation of poll_accept method in tokio (#1890)
This commit is contained in:
committed by
Sean McArthur
parent
a543c8eef2
commit
9d5299b655
@@ -3,6 +3,7 @@ use std::mem;
|
||||
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 {
|
||||
@@ -99,7 +100,9 @@ where
|
||||
loop {
|
||||
match mem::replace(&mut me.state, State::Draining) {
|
||||
State::Watch(on_drain) => {
|
||||
match me.watch.rx.poll_ref(cx) {
|
||||
let mut recv_fut = me.watch.rx.recv_ref().boxed();
|
||||
|
||||
match recv_fut.poll_unpin(cx) {
|
||||
Poll::Ready(None) => {
|
||||
// Drain has been triggered!
|
||||
on_drain(unsafe { Pin::new_unchecked(&mut me.future) });
|
||||
|
||||
Reference in New Issue
Block a user