File tree Expand file tree Collapse file tree 1 file changed +9
-17
lines changed
src/Servers/Kestrel/Core/src/Internal/Http2 Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -668,21 +668,6 @@ private Http2StreamContext CreateHttp2StreamContext()
668
668
return streamContext ;
669
669
}
670
670
671
- private void ReturnStream ( Http2Stream stream )
672
- {
673
- // We're conservative about what streams we can reuse.
674
- // If there is a chance the stream is still in use then don't attempt to reuse it.
675
- Debug . Assert ( stream . CanReuse ) ;
676
-
677
- if ( StreamPool . Count < MaxStreamPoolSize )
678
- {
679
- // This property is used to remove unused streams from the pool
680
- stream . DrainExpirationTicks = SystemClock . UtcNowTicks + StreamPoolExpiryTicks ;
681
-
682
- StreamPool . Push ( stream ) ;
683
- }
684
- }
685
-
686
671
private Task ProcessPriorityFrameAsync ( )
687
672
{
688
673
if ( _currentHeadersStream != null )
@@ -1181,12 +1166,19 @@ private void UpdateCompletedStreams()
1181
1166
private void RemoveStream ( Http2Stream stream )
1182
1167
{
1183
1168
_streams . Remove ( stream . StreamId ) ;
1184
- if ( stream . CanReuse )
1169
+
1170
+ if ( stream . CanReuse && StreamPool . Count < MaxStreamPoolSize )
1185
1171
{
1186
- ReturnStream ( stream ) ;
1172
+ // Pool and reuse the stream if it finished in a graceful state and there is space in the pool.
1173
+
1174
+ // This property is used to remove unused streams from the pool
1175
+ stream . DrainExpirationTicks = SystemClock . UtcNowTicks + StreamPoolExpiryTicks ;
1176
+
1177
+ StreamPool . Push ( stream ) ;
1187
1178
}
1188
1179
else
1189
1180
{
1181
+ // Stream didn't complete gracefully or pool is full.
1190
1182
stream . Dispose ( ) ;
1191
1183
}
1192
1184
}
You can’t perform that action at this time.
0 commit comments