@@ -30,6 +30,10 @@ internal partial class TransportConnection : IFeatureCollection,
3030 // Other reserved feature slots
3131 internal protected IPersistentStateFeature ? _currentIPersistentStateFeature ;
3232 internal protected IConnectionSocketFeature ? _currentIConnectionSocketFeature ;
33+ internal protected IProtocolErrorCodeFeature ? _currentIProtocolErrorCodeFeature ;
34+ internal protected IStreamDirectionFeature ? _currentIStreamDirectionFeature ;
35+ internal protected IStreamIdFeature ? _currentIStreamIdFeature ;
36+ internal protected ITlsConnectionFeature ? _currentITlsConnectionFeature ;
3337
3438 private int _featureRevision ;
3539
@@ -45,6 +49,10 @@ private void FastReset()
4549
4650 _currentIPersistentStateFeature = null ;
4751 _currentIConnectionSocketFeature = null ;
52+ _currentIProtocolErrorCodeFeature = null ;
53+ _currentIStreamDirectionFeature = null ;
54+ _currentIStreamIdFeature = null ;
55+ _currentITlsConnectionFeature = null ;
4856 }
4957
5058 // Internal for testing
@@ -144,6 +152,22 @@ private void ExtraFeatureSet(Type key, object? value)
144152 {
145153 feature = _currentIConnectionSocketFeature ;
146154 }
155+ else if ( key == typeof ( IProtocolErrorCodeFeature ) )
156+ {
157+ feature = _currentIProtocolErrorCodeFeature ;
158+ }
159+ else if ( key == typeof ( IStreamDirectionFeature ) )
160+ {
161+ feature = _currentIStreamDirectionFeature ;
162+ }
163+ else if ( key == typeof ( IStreamIdFeature ) )
164+ {
165+ feature = _currentIStreamIdFeature ;
166+ }
167+ else if ( key == typeof ( ITlsConnectionFeature ) )
168+ {
169+ feature = _currentITlsConnectionFeature ;
170+ }
147171 else if ( MaybeExtra != null )
148172 {
149173 feature = ExtraFeatureGet ( key ) ;
@@ -184,6 +208,22 @@ private void ExtraFeatureSet(Type key, object? value)
184208 {
185209 _currentIConnectionSocketFeature = ( IConnectionSocketFeature ? ) value ;
186210 }
211+ else if ( key == typeof ( IProtocolErrorCodeFeature ) )
212+ {
213+ _currentIProtocolErrorCodeFeature = ( IProtocolErrorCodeFeature ? ) value ;
214+ }
215+ else if ( key == typeof ( IStreamDirectionFeature ) )
216+ {
217+ _currentIStreamDirectionFeature = ( IStreamDirectionFeature ? ) value ;
218+ }
219+ else if ( key == typeof ( IStreamIdFeature ) )
220+ {
221+ _currentIStreamIdFeature = ( IStreamIdFeature ? ) value ;
222+ }
223+ else if ( key == typeof ( ITlsConnectionFeature ) )
224+ {
225+ _currentITlsConnectionFeature = ( ITlsConnectionFeature ? ) value ;
226+ }
187227 else
188228 {
189229 ExtraFeatureSet ( key , value ) ;
@@ -226,6 +266,22 @@ private void ExtraFeatureSet(Type key, object? value)
226266 {
227267 feature = Unsafe . As < IConnectionSocketFeature ? , TFeature ? > ( ref _currentIConnectionSocketFeature ) ;
228268 }
269+ else if ( typeof ( TFeature ) == typeof ( IProtocolErrorCodeFeature ) )
270+ {
271+ feature = Unsafe . As < IProtocolErrorCodeFeature ? , TFeature ? > ( ref _currentIProtocolErrorCodeFeature ) ;
272+ }
273+ else if ( typeof ( TFeature ) == typeof ( IStreamDirectionFeature ) )
274+ {
275+ feature = Unsafe . As < IStreamDirectionFeature ? , TFeature ? > ( ref _currentIStreamDirectionFeature ) ;
276+ }
277+ else if ( typeof ( TFeature ) == typeof ( IStreamIdFeature ) )
278+ {
279+ feature = Unsafe . As < IStreamIdFeature ? , TFeature ? > ( ref _currentIStreamIdFeature ) ;
280+ }
281+ else if ( typeof ( TFeature ) == typeof ( ITlsConnectionFeature ) )
282+ {
283+ feature = Unsafe . As < ITlsConnectionFeature ? , TFeature ? > ( ref _currentITlsConnectionFeature ) ;
284+ }
229285 else if ( MaybeExtra != null )
230286 {
231287 feature = ( TFeature ? ) ( ExtraFeatureGet ( typeof ( TFeature ) ) ) ;
@@ -269,6 +325,22 @@ private void ExtraFeatureSet(Type key, object? value)
269325 {
270326 _currentIConnectionSocketFeature = Unsafe . As < TFeature ? , IConnectionSocketFeature ? > ( ref feature ) ;
271327 }
328+ else if ( typeof ( TFeature ) == typeof ( IProtocolErrorCodeFeature ) )
329+ {
330+ _currentIProtocolErrorCodeFeature = Unsafe . As < TFeature ? , IProtocolErrorCodeFeature ? > ( ref feature ) ;
331+ }
332+ else if ( typeof ( TFeature ) == typeof ( IStreamDirectionFeature ) )
333+ {
334+ _currentIStreamDirectionFeature = Unsafe . As < TFeature ? , IStreamDirectionFeature ? > ( ref feature ) ;
335+ }
336+ else if ( typeof ( TFeature ) == typeof ( IStreamIdFeature ) )
337+ {
338+ _currentIStreamIdFeature = Unsafe . As < TFeature ? , IStreamIdFeature ? > ( ref feature ) ;
339+ }
340+ else if ( typeof ( TFeature ) == typeof ( ITlsConnectionFeature ) )
341+ {
342+ _currentITlsConnectionFeature = Unsafe . As < TFeature ? , ITlsConnectionFeature ? > ( ref feature ) ;
343+ }
272344 else
273345 {
274346 ExtraFeatureSet ( typeof ( TFeature ) , feature ) ;
@@ -305,6 +377,22 @@ private IEnumerable<KeyValuePair<Type, object>> FastEnumerable()
305377 {
306378 yield return new KeyValuePair < Type , object > ( typeof ( IConnectionSocketFeature ) , _currentIConnectionSocketFeature ) ;
307379 }
380+ if ( _currentIProtocolErrorCodeFeature != null )
381+ {
382+ yield return new KeyValuePair < Type , object > ( typeof ( IProtocolErrorCodeFeature ) , _currentIProtocolErrorCodeFeature ) ;
383+ }
384+ if ( _currentIStreamDirectionFeature != null )
385+ {
386+ yield return new KeyValuePair < Type , object > ( typeof ( IStreamDirectionFeature ) , _currentIStreamDirectionFeature ) ;
387+ }
388+ if ( _currentIStreamIdFeature != null )
389+ {
390+ yield return new KeyValuePair < Type , object > ( typeof ( IStreamIdFeature ) , _currentIStreamIdFeature ) ;
391+ }
392+ if ( _currentITlsConnectionFeature != null )
393+ {
394+ yield return new KeyValuePair < Type , object > ( typeof ( ITlsConnectionFeature ) , _currentITlsConnectionFeature ) ;
395+ }
308396
309397 if ( MaybeExtra != null )
310398 {
0 commit comments