@@ -54,8 +54,7 @@ public sealed class GrpcChannel : ChannelBase, IDisposable
5454 private readonly Dictionary < MethodKey , MethodConfig > ? _serviceConfigMethods ;
5555 private readonly bool _isSecure ;
5656 private readonly List < CallCredentials > ? _callCredentials ;
57- // Internal for testing
58- internal readonly HashSet < IDisposable > ActiveCalls ;
57+ private readonly HashSet < IDisposable > _activeCalls ;
5958
6059 internal Uri Address { get ; }
6160 internal HttpMessageInvoker HttpInvoker { get ; }
@@ -165,7 +164,7 @@ internal GrpcChannel(Uri address, GrpcChannelOptions channelOptions) : base(addr
165164 ThrowOperationCanceledOnCancellation = channelOptions . ThrowOperationCanceledOnCancellation ;
166165 UnsafeUseInsecureChannelCallCredentials = channelOptions . UnsafeUseInsecureChannelCallCredentials ;
167166 _createMethodInfoFunc = CreateMethodInfo ;
168- ActiveCalls = new HashSet < IDisposable > ( ) ;
167+ _activeCalls = new HashSet < IDisposable > ( ) ;
169168 if ( channelOptions . ServiceConfig is { } serviceConfig )
170169 {
171170 RetryThrottling = serviceConfig . RetryThrottling != null ? CreateChannelRetryThrottling ( serviceConfig . RetryThrottling ) : null ;
@@ -490,15 +489,15 @@ internal void RegisterActiveCall(IDisposable grpcCall)
490489 throw new ObjectDisposedException ( nameof ( GrpcChannel ) ) ;
491490 }
492491
493- ActiveCalls . Add ( grpcCall ) ;
492+ _activeCalls . Add ( grpcCall ) ;
494493 }
495494 }
496495
497496 internal void FinishActiveCall ( IDisposable grpcCall )
498497 {
499498 lock ( _lock )
500499 {
501- ActiveCalls . Remove ( grpcCall ) ;
500+ _activeCalls . Remove ( grpcCall ) ;
502501 }
503502 }
504503
@@ -749,9 +748,9 @@ public void Dispose()
749748 return ;
750749 }
751750
752- if ( ActiveCalls . Count > 0 )
751+ if ( _activeCalls . Count > 0 )
753752 {
754- activeCallsCopy = ActiveCalls . ToArray ( ) ;
753+ activeCallsCopy = _activeCalls . ToArray ( ) ;
755754 }
756755
757756 Disposed = true ;
@@ -807,6 +806,15 @@ internal int GetRandomNumber(int minValue, int maxValue)
807806 }
808807 }
809808
809+ // Internal for testing
810+ internal IDisposable [ ] GetActiveCalls ( )
811+ {
812+ lock ( _lock )
813+ {
814+ return _activeCalls . ToArray ( ) ;
815+ }
816+ }
817+
810818#if SUPPORT_LOAD_BALANCING
811819 private sealed class SubChannelTransportFactory : ISubchannelTransportFactory
812820 {
0 commit comments