@@ -415,7 +415,7 @@ private Task ProcessFrameAsync<TContext>(IHttpApplication<TContext> application,
415
415
case Http2FrameType . WINDOW_UPDATE :
416
416
return ProcessWindowUpdateFrameAsync ( ) ;
417
417
case Http2FrameType . CONTINUATION :
418
- return ProcessContinuationFrameAsync ( application , payload ) ;
418
+ return ProcessContinuationFrameAsync ( payload ) ;
419
419
default :
420
420
return ProcessUnknownFrameAsync ( ) ;
421
421
}
@@ -558,7 +558,7 @@ private Task ProcessHeadersFrameAsync<TContext>(IHttpApplication<TContext> appli
558
558
}
559
559
560
560
// Start a new stream
561
- _currentHeadersStream = new Http2Stream ( new Http2StreamContext
561
+ _currentHeadersStream = new Http2Stream < TContext > ( application , new Http2StreamContext
562
562
{
563
563
ConnectionId = ConnectionId ,
564
564
StreamId = _incomingFrame . StreamId ,
@@ -580,7 +580,7 @@ private Task ProcessHeadersFrameAsync<TContext>(IHttpApplication<TContext> appli
580
580
_headerFlags = _incomingFrame . HeadersFlags ;
581
581
582
582
var headersPayload = payload . Slice ( 0 , _incomingFrame . HeadersPayloadLength ) ; // Minus padding
583
- return DecodeHeadersAsync ( application , _incomingFrame . HeadersEndHeaders , headersPayload ) ;
583
+ return DecodeHeadersAsync ( _incomingFrame . HeadersEndHeaders , headersPayload ) ;
584
584
}
585
585
}
586
586
@@ -822,7 +822,7 @@ private Task ProcessWindowUpdateFrameAsync()
822
822
return Task . CompletedTask ;
823
823
}
824
824
825
- private Task ProcessContinuationFrameAsync < TContext > ( IHttpApplication < TContext > application , ReadOnlySequence < byte > payload )
825
+ private Task ProcessContinuationFrameAsync ( ReadOnlySequence < byte > payload )
826
826
{
827
827
if ( _currentHeadersStream == null )
828
828
{
@@ -847,7 +847,7 @@ private Task ProcessContinuationFrameAsync<TContext>(IHttpApplication<TContext>
847
847
TimeoutControl . CancelTimeout ( ) ;
848
848
}
849
849
850
- return DecodeHeadersAsync ( application , _incomingFrame . ContinuationEndHeaders , payload ) ;
850
+ return DecodeHeadersAsync ( _incomingFrame . ContinuationEndHeaders , payload ) ;
851
851
}
852
852
}
853
853
@@ -861,7 +861,7 @@ private Task ProcessUnknownFrameAsync()
861
861
return Task . CompletedTask ;
862
862
}
863
863
864
- private Task DecodeHeadersAsync < TContext > ( IHttpApplication < TContext > application , bool endHeaders , ReadOnlySequence < byte > payload )
864
+ private Task DecodeHeadersAsync ( bool endHeaders , ReadOnlySequence < byte > payload )
865
865
{
866
866
try
867
867
{
@@ -870,7 +870,7 @@ private Task DecodeHeadersAsync<TContext>(IHttpApplication<TContext> application
870
870
871
871
if ( endHeaders )
872
872
{
873
- StartStream ( application ) ;
873
+ StartStream ( ) ;
874
874
ResetRequestHeaderParsingState ( ) ;
875
875
}
876
876
}
@@ -896,7 +896,7 @@ private Task DecodeTrailersAsync(bool endHeaders, ReadOnlySequence<byte> payload
896
896
return Task . CompletedTask ;
897
897
}
898
898
899
- private void StartStream < TContext > ( IHttpApplication < TContext > application )
899
+ private void StartStream ( )
900
900
{
901
901
if ( ! _isMethodConnect && ( _parsedPseudoHeaderFields & _mandatoryRequestPseudoHeaderFields ) != _mandatoryRequestPseudoHeaderFields )
902
902
{
@@ -923,12 +923,7 @@ private void StartStream<TContext>(IHttpApplication<TContext> application)
923
923
_activeStreamCount ++ ;
924
924
_streams [ _incomingFrame . StreamId ] = _currentHeadersStream ;
925
925
// Must not allow app code to block the connection handling loop.
926
- ThreadPool . UnsafeQueueUserWorkItem ( state =>
927
- {
928
- var ( app , currentStream ) = ( Tuple < IHttpApplication < TContext > , Http2Stream > ) state ;
929
- _ = currentStream . ProcessRequestsAsync ( app ) ;
930
- } ,
931
- new Tuple < IHttpApplication < TContext > , Http2Stream > ( application , _currentHeadersStream ) ) ;
926
+ ThreadPool . UnsafeQueueUserWorkItem ( _currentHeadersStream , preferLocal : false ) ;
932
927
}
933
928
934
929
private void ResetRequestHeaderParsingState ( )
0 commit comments