File tree Expand file tree Collapse file tree
tests/CHttpServer.Tests/Http3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,22 +56,24 @@ public async Task MultipleWrites_HeaderFrame()
5656
5757 TaskCompletionSource tcs = new ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
5858 sut . Initialize ( null , await serverStreamTask ) ;
59- var testApp = new TestBase . TestApplication ( ctx =>
59+ var testApp = new TestBase . TestApplication ( async ctx =>
6060 {
6161 Assert . Equal ( "/" , ctx . Request . Path ) ;
6262 Assert . Equal ( "https" , ctx . Request . Scheme ) ;
6363 Assert . Equal ( "localhost" , ctx . Request . Host . ToString ( ) ) ;
6464 Assert . Equal ( HttpMethod . Get . ToString ( ) , ctx . Request . Method ) ;
65- tcs . SetResult ( ) ;
66- return Task . CompletedTask ;
65+
66+ // This callback shall not complete before the 2nd flush, otherwise the
67+ // server might close the stream before the flush succeeds.
68+ await tcs . Task ;
6769 } ) ;
6870 var processing = sut . ProcessStreamAsync ( testApp , TestContext . Current . CancellationToken ) ;
6971
7072 // Second Write
7173 await clientStream . WriteAsync ( headersFrame [ i ..] , TestContext . Current . CancellationToken ) ;
7274 await clientStream . FlushAsync ( TestContext . Current . CancellationToken ) ;
75+ tcs . SetResult ( ) ;
7376
74- await tcs . Task . WaitAsync ( DefaultTimeout , TestContext . Current . CancellationToken ) ;
7577 clientStream . Close ( ) ;
7678 await processing ;
7779 await quicConnection . DisposeAsync ( ) ;
You can’t perform that action at this time.
0 commit comments