refactor(client): make conn::ResponseFuture implement Send

This commit is contained in:
Sean McArthur
2018-03-13 16:34:12 -07:00
parent dcfebc6308
commit 26ec18a282
3 changed files with 63 additions and 19 deletions

View File

@@ -2,7 +2,6 @@ use std::io;
use bytes::Bytes;
use futures::{Async, AsyncSink, Future, Poll, Stream};
use futures::sync::oneshot;
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_service::Service;
@@ -33,7 +32,7 @@ pub struct Server<S: Service> {
}
pub struct Client<B> {
callback: Option<oneshot::Sender<Result<::Response, (::Error, Option<ClientMsg<B>>)>>>,
callback: Option<::client::dispatch::Callback<ClientMsg<B>, ::Response>>,
rx: ClientRx<B>,
}
@@ -475,7 +474,7 @@ mod tests {
subject: ::proto::RequestLine::default(),
headers: Default::default(),
};
let res_rx = tx.send((req, None::<::Body>)).unwrap();
let res_rx = tx.try_send((req, None::<::Body>)).unwrap();
let a1 = dispatcher.poll().expect("error should be sent on channel");
assert!(a1.is_ready(), "dispatcher should be closed");