File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -438,7 +438,7 @@ fn expect_continue() {
438438}
439439
440440#[ test]
441- fn pipline_disabled ( ) {
441+ fn pipeline_disabled ( ) {
442442 let server = serve ( ) ;
443443 let mut req = connect ( server. addr ( ) ) ;
444444 server. reply ( ) . status ( hyper:: Ok ) ;
@@ -456,8 +456,23 @@ fn pipline_disabled() {
456456 let mut buf = vec ! [ 0 ; 4096 ] ;
457457 let n = req. read ( & mut buf) . expect ( "read 1" ) ;
458458 assert_ne ! ( n, 0 ) ;
459- let n = req. read ( & mut buf) . expect ( "read 2" ) ;
460- assert_ne ! ( n, 0 ) ;
459+ // Woah there. What?
460+ //
461+ // This test is wishy-washy because of race conditions in access of the
462+ // socket. The test is still useful, since it allows for the responses
463+ // to be received in 2 reads. But it might sometimes come in 1 read.
464+ //
465+ // TODO: add in a delay to the `ServeReply` interface, to allow this
466+ // delay to prevent the 2 writes from happening before this test thread
467+ // can read from the socket.
468+ match req. read ( & mut buf) {
469+ Ok ( n) => {
470+ // won't be 0, because we didn't say to close, and so socket
471+ // will be open until `server` drops
472+ assert_ne ! ( n, 0 ) ;
473+ }
474+ Err ( _) => ( ) ,
475+ }
461476}
462477
463478#[ test]
@@ -579,8 +594,6 @@ impl NewService for TestService {
579594 fn new_service ( & self ) -> std:: io:: Result < TestService > {
580595 Ok ( self . clone ( ) )
581596 }
582-
583-
584597}
585598
586599impl Service for TestService {
You can’t perform that action at this time.
0 commit comments