-
-
Save brigand/efd5328db5a4209e5212cd76b12693cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/client/paired.rs b/src/client/paired.rs | |
index 25e5216..3b88af0 100644 | |
--- a/src/client/paired.rs | |
+++ b/src/client/paired.rs | |
@@ -13,8 +13,8 @@ use std::net::SocketAddr; | |
use std::sync::{Arc, Mutex}; | |
use futures::{future, Future, Sink, Stream}; | |
-use futures::future::Executor; | |
use futures::sync::{mpsc, oneshot}; | |
+use tokio::executor::{Executor, DefaultExecutor}; | |
use error; | |
use resp; | |
@@ -25,13 +25,12 @@ type PairedConnectionBox = Box<Future<Item = PairedConnection, Error = error::Er | |
/// The default starting point to use most default Redis functionality. | |
/// | |
/// Returns a future that resolves to a `PairedConnection`. | |
-pub fn paired_connect<E>(addr: &SocketAddr, executor: E) -> PairedConnectionBox | |
-where | |
- E: Executor<Box<Future<Item = (), Error = ()> + Send>> + 'static, | |
+pub fn paired_connect(addr: &SocketAddr) -> PairedConnectionBox | |
{ | |
let paired_con = connect(addr) | |
.map_err(|e| e.into()) | |
.and_then(move |connection| { | |
+ let mut executor = DefaultExecutor::current(); | |
let ClientConnection { sender, receiver } = connection; | |
let (out_tx, out_rx) = mpsc::unbounded(); | |
let running = Arc::new(Mutex::new(true)); | |
@@ -86,8 +85,9 @@ where | |
) as Box<Future<Item = (), Error = ()> + Send>; | |
match executor | |
- .execute(sender) | |
- .and_then(|_| executor.execute(receiver)) | |
+ .spawn(sender) | |
+ .and_then(|_| executor.spawn(receiver)) | |
+ | |
{ | |
Ok(()) => future::ok(PairedConnection { | |
out_tx: out_tx, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment