From 97ed0478a871f45555ee1985ae228a0adc27c35a Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Wed, 25 Mar 2020 13:32:06 -0700 Subject: [PATCH] refactor(client): replace futures oneshot with tokio in dispatcher --- src/client/dispatch.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs index 87ac0b09..9a580f85 100644 --- a/src/client/dispatch.rs +++ b/src/client/dispatch.rs @@ -1,6 +1,5 @@ -use futures_channel::oneshot; use futures_util::future; -use tokio::sync::mpsc; +use tokio::sync::{mpsc, oneshot}; use crate::common::{task, Future, Pin, Poll}; @@ -195,15 +194,15 @@ pub enum Callback { impl Callback { pub(crate) fn is_canceled(&self) -> bool { match *self { - Callback::Retry(ref tx) => tx.is_canceled(), - Callback::NoRetry(ref tx) => tx.is_canceled(), + Callback::Retry(ref tx) => tx.is_closed(), + Callback::NoRetry(ref tx) => tx.is_closed(), } } pub(crate) fn poll_canceled(&mut self, cx: &mut task::Context<'_>) -> Poll<()> { match *self { - Callback::Retry(ref mut tx) => tx.poll_canceled(cx), - Callback::NoRetry(ref mut tx) => tx.poll_canceled(cx), + Callback::Retry(ref mut tx) => tx.poll_closed(cx), + Callback::NoRetry(ref mut tx) => tx.poll_closed(cx), } }