split Client into (Client, Connection) (#107)
The Connection type is a `Future` that drives all of the IO of the client connection. The Client type is separate, and is used to send requests into the connection.
This commit is contained in:
@@ -67,7 +67,7 @@ pub fn main() {
|
||||
Client::handshake(tls)
|
||||
})
|
||||
.then(|res| {
|
||||
let mut h2 = res.unwrap();
|
||||
let (mut client, h2) = res.unwrap();
|
||||
|
||||
let request = Request::builder()
|
||||
.method(Method::GET)
|
||||
@@ -75,7 +75,7 @@ pub fn main() {
|
||||
.body(())
|
||||
.unwrap();
|
||||
|
||||
let stream = h2.send_request(request, true).unwrap();
|
||||
let stream = client.send_request(request, true).unwrap();
|
||||
|
||||
let stream = stream.and_then(|response| {
|
||||
let (_, body) = response.into_parts();
|
||||
|
||||
@@ -58,7 +58,7 @@ pub fn main() {
|
||||
let tcp = io_dump::Dump::to_stdout(res.unwrap());
|
||||
Client::handshake(tcp)
|
||||
}).then(|res| {
|
||||
let mut client = res.unwrap();
|
||||
let (mut client, h2) = res.unwrap();
|
||||
|
||||
println!("sending request");
|
||||
|
||||
@@ -75,8 +75,8 @@ pub fn main() {
|
||||
// send trailers
|
||||
stream.send_trailers(trailers).unwrap();
|
||||
|
||||
// Spawn a task to run the client...
|
||||
handle.spawn(client.map_err(|e| println!("GOT ERR={:?}", e)));
|
||||
// Spawn a task to run the conn...
|
||||
handle.spawn(h2.map_err(|e| println!("GOT ERR={:?}", e)));
|
||||
|
||||
stream
|
||||
.and_then(|response| {
|
||||
|
||||
Reference in New Issue
Block a user