@@ -9,7 +9,7 @@ use rustls::pki_types::ServerName;
99use rustls:: { ClientConnection , Connection , ServerConnection } ;
1010use tokio:: io:: { AsyncRead , AsyncReadExt , AsyncWrite , AsyncWriteExt , ReadBuf } ;
1111
12- use super :: Stream ;
12+ use super :: { PacketProcessingMode , Stream } ;
1313
1414struct Good < ' a > ( & ' a mut Connection ) ;
1515
@@ -229,12 +229,13 @@ async fn stream_handshake() -> io::Result<()> {
229229 {
230230 let mut good = Good ( & mut server) ;
231231 let mut stream = Stream :: new ( & mut good, & mut client) ;
232- let ( r, w) = poll_fn ( |cx| stream. handshake ( cx, false ) ) . await ?;
232+ let ( r, w) = poll_fn ( |cx| stream. handshake ( cx, PacketProcessingMode :: Sync ) ) . await ?;
233233
234234 assert ! ( r > 0 ) ;
235235 assert ! ( w > 0 ) ;
236236
237- poll_fn ( |cx : & mut Context < ' _ > | stream. handshake ( cx, false ) ) . await ?; // finish server handshake
237+ poll_fn ( |cx : & mut Context < ' _ > | stream. handshake ( cx, PacketProcessingMode :: Sync ) ) . await ?;
238+ // finish server handshake
238239 }
239240
240241 assert ! ( !server. is_handshaking( ) ) ;
@@ -253,12 +254,12 @@ async fn stream_buffered_handshake() -> io::Result<()> {
253254 {
254255 let mut good = BufWriter :: new ( Good ( & mut server) ) ;
255256 let mut stream = Stream :: new ( & mut good, & mut client) ;
256- let ( r, w) = poll_fn ( |cx| stream. handshake ( cx, false ) ) . await ?;
257+ let ( r, w) = poll_fn ( |cx| stream. handshake ( cx, PacketProcessingMode :: Sync ) ) . await ?;
257258
258259 assert ! ( r > 0 ) ;
259260 assert ! ( w > 0 ) ;
260261
261- poll_fn ( |cx| stream. handshake ( cx, false ) ) . await ?; // finish server handshake
262+ poll_fn ( |cx| stream. handshake ( cx, PacketProcessingMode :: Sync ) ) . await ?; // finish server handshake
262263 }
263264
264265 assert ! ( !server. is_handshaking( ) ) ;
@@ -275,7 +276,7 @@ async fn stream_handshake_eof() -> io::Result<()> {
275276 let mut stream = Stream :: new ( & mut bad, & mut client) ;
276277
277278 let mut cx = Context :: from_waker ( noop_waker_ref ( ) ) ;
278- let r = stream. handshake ( & mut cx, false ) ;
279+ let r = stream. handshake ( & mut cx, PacketProcessingMode :: Sync ) ;
279280 assert_eq ! (
280281 r. map_err( |err| err. kind( ) ) ,
281282 Poll :: Ready ( Err ( io:: ErrorKind :: UnexpectedEof ) )
@@ -292,7 +293,7 @@ async fn stream_handshake_write_eof() -> io::Result<()> {
292293 let mut stream = Stream :: new ( & mut io, & mut client) ;
293294
294295 let mut cx = Context :: from_waker ( noop_waker_ref ( ) ) ;
295- let r = stream. handshake ( & mut cx, false ) ;
296+ let r = stream. handshake ( & mut cx, PacketProcessingMode :: Sync ) ;
296297 assert_eq ! (
297298 r. map_err( |err| err. kind( ) ) ,
298299 Poll :: Ready ( Err ( io:: ErrorKind :: WriteZero ) )
@@ -310,7 +311,7 @@ async fn stream_handshake_regression_issues_77() -> io::Result<()> {
310311 let mut stream = Stream :: new ( & mut bad, & mut client) ;
311312
312313 let mut cx = Context :: from_waker ( noop_waker_ref ( ) ) ;
313- let r = stream. handshake ( & mut cx, false ) ;
314+ let r = stream. handshake ( & mut cx, PacketProcessingMode :: Sync ) ;
314315 assert_eq ! (
315316 r. map_err( |err| err. kind( ) ) ,
316317 Poll :: Ready ( Err ( io:: ErrorKind :: InvalidData ) )
@@ -366,31 +367,33 @@ async fn async_process_packets() -> io::Result<()> {
366367 let mut stream = Stream :: new ( & mut good, & mut client) ;
367368
368369 // if feature is enabled, we expect a blocking response on process packets throughout the handshake,
369- #[ cfg( feature = "compute-heavy-future-executor" ) ]
370- { let result = poll_fn ( |cx| stream. handshake ( cx, true ) ) . await ;
370+ #[ cfg( feature = "vacation" ) ]
371+ {
372+ let result = poll_fn ( |cx| stream. handshake ( cx, PacketProcessingMode :: Async ) ) . await ;
371373
372374 assert_eq ! (
373375 result. err( ) . map( |e| e. kind( ) ) ,
374376 Some ( io:: ErrorKind :: WouldBlock )
375377 ) ;
376378
377379 // finish the handshake without delegating to async session
378- poll_fn ( |cx| stream. handshake ( cx, false ) ) . await ?; // client handshake
379- poll_fn ( |cx : & mut Context < ' _ > | stream. handshake ( cx, true ) ) . await ?; // server handshake
380+ poll_fn ( |cx| stream. handshake ( cx, PacketProcessingMode :: Sync ) ) . await ?; // client handshake
381+ poll_fn ( |cx : & mut Context < ' _ > | stream. handshake ( cx, PacketProcessingMode :: Sync ) ) . await ?;
382+ // server handshake
380383 }
381384
382- // if feature is disabled, we expect normal handling
383- #[ cfg( not( feature = "compute-heavy-future-executor " ) ) ]
385+ // if feature is disabled, we expect normal handling even if async is passed in
386+ #[ cfg( not( feature = "vacation " ) ) ]
384387 {
385388 {
386- let ( r, w) = poll_fn ( |cx| stream. handshake ( cx, true ) ) . await ?; // client handshake
387-
389+ let ( r, w) = poll_fn ( |cx| stream. handshake ( cx, PacketProcessingMode :: Async ) ) . await ?; // client handshake
390+
388391 assert ! ( r > 0 ) ;
389392 assert ! ( w > 0 ) ;
390-
391- poll_fn ( |cx| stream. handshake ( cx, true ) ) . await ?; // server handshake
393+
394+ poll_fn ( |cx| stream. handshake ( cx, PacketProcessingMode :: Async ) ) . await ?;
395+ // server handshake
392396 }
393-
394397 }
395398
396399 // once handshake is done, there is no longer blocking sending data over the stream
@@ -426,7 +429,7 @@ fn do_handshake(
426429 let mut stream = Stream :: new ( & mut good, client) ;
427430
428431 while stream. session . is_handshaking ( ) {
429- ready ! ( stream. handshake( cx, false ) ) ?;
432+ ready ! ( stream. handshake( cx, PacketProcessingMode :: Sync ) ) ?;
430433 }
431434
432435 while stream. session . wants_write ( ) {
0 commit comments