@@ -2055,16 +2055,19 @@ mod conn {
2055
2055
. await
2056
2056
. expect ( "write 1" ) ;
2057
2057
let _ = done_rx. await ;
2058
+ eprintln ! ( "bye server" ) ;
2058
2059
} ) ;
2059
2060
2060
2061
// make polling fair by putting both in spawns
2061
2062
tokio:: spawn ( async move {
2063
+ eprintln ! ( "client start" ) ;
2062
2064
let io = tcp_connect ( & addr) . await . expect ( "tcp connect" ) ;
2063
2065
let ( mut client, conn) = conn:: http1:: Builder :: new ( )
2064
2066
. handshake :: < _ , Empty < Bytes > > ( io)
2065
2067
. await
2066
2068
. expect ( "http handshake" ) ;
2067
2069
2070
+ eprintln ! ( "client connected" ) ;
2068
2071
let mut conn = std:: pin:: pin!( conn) ;
2069
2072
2070
2073
// get the conn ready
@@ -2073,6 +2076,7 @@ mod conn {
2073
2076
. is_pending( ) ) ;
2074
2077
assert ! ( client. is_ready( ) ) ;
2075
2078
2079
+ eprintln ! ( "client send1" ) ;
2076
2080
// use the connection once
2077
2081
let mut fut1 = std:: pin:: pin!( client. send_request( http:: Request :: new( Empty :: new( ) ) ) ) ;
2078
2082
let _res1 = future:: poll_fn ( |cx| loop {
@@ -2089,32 +2093,37 @@ mod conn {
2089
2093
2090
2094
assert ! ( client. is_ready( ) ) ;
2091
2095
2096
+ eprintln ! ( "client trigger server end" ) ;
2092
2097
// simulate the server dropping the conn
2093
2098
let _ = done_tx. send ( ( ) ) ;
2094
2099
// let the server task die
2095
2100
// a full sleep might needed to make Windows happy
2096
2101
tokio:: time:: sleep ( Duration :: from_millis ( 10 ) ) . await ;
2102
+ eprintln ! ( "client slept" ) ;
2097
2103
2098
2104
let mut fut2 =
2099
2105
std:: pin:: pin!( client. try_send_request( http:: Request :: new( Empty :: new( ) ) ) ) ;
2100
2106
let poll1 = future:: poll_fn ( |cx| Poll :: Ready ( fut2. as_mut ( ) . poll ( cx) ) ) . await ;
2101
2107
assert ! ( poll1. is_pending( ) , "not already known to error" ) ;
2108
+ eprintln ! ( "client try_send 2" ) ;
2102
2109
2103
2110
// wasn't a known error, req is in queue, and now the next poll, the
2104
2111
// conn will be noticed as errored
2105
2112
let mut err = future:: poll_fn ( |cx| {
2106
2113
loop {
2114
+ eprintln ! ( "client try_send poll loop" ) ;
2107
2115
if let Poll :: Ready ( res) = fut2. as_mut ( ) . poll ( cx) {
2108
2116
return Poll :: Ready ( res) ;
2109
2117
}
2110
2118
match conn. as_mut ( ) . poll ( cx) {
2111
- Poll :: Ready ( _ ) => continue , // ok
2119
+ Poll :: Ready ( c ) => { dbg ! ( c ) ; } , // ok
2112
2120
Poll :: Pending => return Poll :: Pending ,
2113
2121
} ;
2114
2122
}
2115
2123
} )
2116
2124
. await
2117
2125
. expect_err ( "resp 2" ) ;
2126
+ eprintln ! ( "client error 2" ) ;
2118
2127
2119
2128
assert ! ( err. take_message( ) . is_some( ) , "request was returned" ) ;
2120
2129
} )
0 commit comments