Skip to content

Commit 322d7d0

Browse files
committed
server no_proto
1 parent 398ad6a commit 322d7d0

File tree

10 files changed

+397
-59
lines changed

10 files changed

+397
-59
lines changed

examples/hello.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ impl Service for Hello {
3131
fn main() {
3232
pretty_env_logger::init().unwrap();
3333
let addr = "127.0.0.1:3000".parse().unwrap();
34-
let server = Http::new().bind(&addr, || Ok(Hello)).unwrap();
34+
let mut server = Http::new().bind(&addr, || Ok(Hello)).unwrap();
35+
server.no_proto();
3536
println!("Listening on http://{} with 1 thread.", server.local_addr().unwrap());
3637
server.run().unwrap();
3738
}

examples/server.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ fn main() {
4747
pretty_env_logger::init().unwrap();
4848
let addr = "127.0.0.1:1337".parse().unwrap();
4949

50-
let server = Http::new().bind(&addr, || Ok(Echo)).unwrap();
50+
let mut server = Http::new().bind(&addr, || Ok(Echo)).unwrap();
51+
server.no_proto();
5152
println!("Listening on http://{} with 1 thread.", server.local_addr().unwrap());
5253
server.run().unwrap();
5354
}

src/client/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ where T: AsyncRead + AsyncWrite + 'static,
265265
type Response = proto::ResponseHead;
266266
type ResponseBody = proto::Chunk;
267267
type Error = ::Error;
268-
type Transport = proto::Conn<T, B::Item, proto::ClientTransaction, proto::ProtoOnion, Pooled<TokioClient<B>>>;
268+
type Transport = proto::Conn<T, B::Item, proto::ClientTransaction, proto::ProtoDispatch, Pooled<TokioClient<B>>>;
269269
type BindTransport = BindingClient<T, B>;
270270

271271
fn bind_transport(&self, io: T) -> Self::BindTransport {
@@ -286,13 +286,13 @@ where T: AsyncRead + AsyncWrite + 'static,
286286
B: Stream<Error=::Error>,
287287
B::Item: AsRef<[u8]>,
288288
{
289-
type Item = proto::Conn<T, B::Item, proto::ClientTransaction, proto::ProtoOnion, Pooled<TokioClient<B>>>;
289+
type Item = proto::Conn<T, B::Item, proto::ClientTransaction, proto::ProtoDispatch, Pooled<TokioClient<B>>>;
290290
type Error = io::Error;
291291

292292
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
293293
match self.rx.poll() {
294294
Ok(Async::Ready(client)) => Ok(Async::Ready(
295-
proto::Conn::new(self.io.take().expect("binding client io lost"), client, proto::ProtoOnion)
295+
proto::Conn::new(self.io.take().expect("binding client io lost"), client, proto::ProtoDispatch)
296296
)),
297297
Ok(Async::NotReady) => Ok(Async::NotReady),
298298
Err(_canceled) => unreachable!(),

src/proto/body.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::borrow::Cow;
77
use super::Chunk;
88

99
pub type TokioBody = tokio_proto::streaming::Body<Chunk, ::Error>;
10+
pub type BodySender = mpsc::Sender<Result<Chunk, ::Error>>;
1011

1112
/// A `Stream` for `Chunk`s used in requests and responses.
1213
#[must_use = "streams do nothing unless polled"]

0 commit comments

Comments
 (0)