@@ -45,7 +45,7 @@ public ServerCounters GetCounters()
4545 {
4646 counters . Add ( snapshot [ i ] . GetCounters ( ) ) ;
4747 }
48- unprocessableCompletionManager . GetCounters ( counters . Other ) ;
48+ UnprocessableCompletionManager . GetCounters ( counters . Other ) ;
4949 return counters ;
5050 }
5151
@@ -123,7 +123,7 @@ internal void OnConnectionFailed(EndPoint endpoint, ConnectionType connectionTyp
123123 var handler = ConnectionFailed ;
124124 if ( handler != null )
125125 {
126- unprocessableCompletionManager . CompleteSyncOrAsync (
126+ UnprocessableCompletionManager . CompleteSyncOrAsync (
127127 new ConnectionFailedEventArgs ( handler , this , endpoint , connectionType , failureType , exception )
128128 ) ;
129129 }
@@ -142,7 +142,7 @@ internal void OnInternalError(Exception exception, EndPoint endpoint = null, Con
142142 var handler = InternalError ;
143143 if ( handler != null )
144144 {
145- unprocessableCompletionManager . CompleteSyncOrAsync (
145+ UnprocessableCompletionManager . CompleteSyncOrAsync (
146146 new InternalErrorEventArgs ( handler , this , endpoint , connectionType , exception , origin )
147147 ) ;
148148 }
@@ -158,7 +158,7 @@ internal void OnConnectionRestored(EndPoint endpoint, ConnectionType connectionT
158158 var handler = ConnectionRestored ;
159159 if ( handler != null )
160160 {
161- unprocessableCompletionManager . CompleteSyncOrAsync (
161+ UnprocessableCompletionManager . CompleteSyncOrAsync (
162162 new ConnectionFailedEventArgs ( handler , this , endpoint , connectionType , ConnectionFailureType . None , null )
163163 ) ;
164164 }
@@ -170,7 +170,7 @@ private void OnEndpointChanged(EndPoint endpoint, EventHandler<EndPointEventArgs
170170 if ( isDisposed ) return ;
171171 if ( handler != null )
172172 {
173- unprocessableCompletionManager . CompleteSyncOrAsync (
173+ UnprocessableCompletionManager . CompleteSyncOrAsync (
174174 new EndPointEventArgs ( handler , this , endpoint )
175175 ) ;
176176 }
@@ -189,7 +189,7 @@ internal void OnErrorMessage(EndPoint endpoint, string message)
189189 var handler = ErrorMessage ;
190190 if ( handler != null )
191191 {
192- unprocessableCompletionManager . CompleteSyncOrAsync (
192+ UnprocessableCompletionManager . CompleteSyncOrAsync (
193193 new RedisErrorEventArgs ( handler , this , endpoint , message )
194194 ) ;
195195 }
@@ -481,7 +481,7 @@ private static void WriteNormalizingLineEndings(string source, StreamWriter writ
481481 /// <summary>
482482 /// Gets the timeout associated with the connections
483483 /// </summary>
484- public int TimeoutMilliseconds => timeoutMilliseconds ;
484+ public int TimeoutMilliseconds { get ; }
485485
486486 /// <summary>
487487 /// Gets all endpoints defined on the server
@@ -494,13 +494,11 @@ public EndPoint[] GetEndPoints(bool configuredOnly = false)
494494 return ConvertHelper . ConvertAll ( serverSnapshot , x => x . EndPoint ) ;
495495 }
496496
497- private readonly int timeoutMilliseconds ;
498-
499497 private readonly ConfigurationOptions configuration ;
500498
501499 internal bool TryResend ( int hashSlot , Message message , EndPoint endpoint , bool isMoved )
502500 {
503- return serverSelectionStrategy . TryResend ( hashSlot , message , endpoint , isMoved ) ;
501+ return ServerSelectionStrategy . TryResend ( hashSlot , message , endpoint , isMoved ) ;
504502 }
505503
506504 /// <summary>
@@ -510,7 +508,7 @@ internal bool TryResend(int hashSlot, Message message, EndPoint endpoint, bool i
510508 public void Wait ( Task task )
511509 {
512510 if ( task == null ) throw new ArgumentNullException ( nameof ( task ) ) ;
513- if ( ! task . Wait ( timeoutMilliseconds ) ) throw new TimeoutException ( ) ;
511+ if ( ! task . Wait ( TimeoutMilliseconds ) ) throw new TimeoutException ( ) ;
514512 }
515513
516514 /// <summary>
@@ -521,7 +519,7 @@ public void Wait(Task task)
521519 public T Wait < T > ( Task < T > task )
522520 {
523521 if ( task == null ) throw new ArgumentNullException ( nameof ( task ) ) ;
524- if ( ! task . Wait ( timeoutMilliseconds ) ) throw new TimeoutException ( ) ;
522+ if ( ! task . Wait ( TimeoutMilliseconds ) ) throw new TimeoutException ( ) ;
525523 return task . Result ;
526524 }
527525
@@ -533,10 +531,10 @@ public void WaitAll(params Task[] tasks)
533531 {
534532 if ( tasks == null ) throw new ArgumentNullException ( nameof ( tasks ) ) ;
535533 if ( tasks . Length == 0 ) return ;
536- if ( ! Task . WaitAll ( tasks , timeoutMilliseconds ) ) throw new TimeoutException ( ) ;
534+ if ( ! Task . WaitAll ( tasks , TimeoutMilliseconds ) ) throw new TimeoutException ( ) ;
537535 }
538536
539- private bool WaitAllIgnoreErrors ( Task [ ] tasks ) => WaitAllIgnoreErrors ( tasks , timeoutMilliseconds ) ;
537+ private bool WaitAllIgnoreErrors ( Task [ ] tasks ) => WaitAllIgnoreErrors ( tasks , TimeoutMilliseconds ) ;
540538
541539 private static bool WaitAllIgnoreErrors ( Task [ ] tasks , int timeout )
542540 {
@@ -677,7 +675,7 @@ internal void OnHashSlotMoved(int hashSlot, EndPoint old, EndPoint @new)
677675 var handler = HashSlotMoved ;
678676 if ( handler != null )
679677 {
680- unprocessableCompletionManager . CompleteSyncOrAsync (
678+ UnprocessableCompletionManager . CompleteSyncOrAsync (
681679 new HashSlotMovedEventArgs ( handler , this , hashSlot , old , @new )
682680 ) ;
683681 }
@@ -687,7 +685,7 @@ internal void OnHashSlotMoved(int hashSlot, EndPoint old, EndPoint @new)
687685 /// Compute the hash-slot of a specified key
688686 /// </summary>
689687 /// <param name="key">The key to get a hash slot ID for.</param>
690- public int HashSlot ( RedisKey key ) => serverSelectionStrategy . HashSlot ( key ) ;
688+ public int HashSlot ( RedisKey key ) => ServerSelectionStrategy . HashSlot ( key ) ;
691689
692690 internal ServerEndPoint AnyConnected ( ServerType serverType , uint startOffset , RedisCommand command , CommandFlags flags )
693691 {
@@ -910,11 +908,11 @@ private ConnectionMultiplexer(ConfigurationOptions configuration)
910908 }
911909
912910 PreserveAsyncOrder = configuration . PreserveAsyncOrder ;
913- timeoutMilliseconds = configuration . SyncTimeout ;
911+ TimeoutMilliseconds = configuration . SyncTimeout ;
914912
915913 OnCreateReaderWriter ( configuration ) ;
916- unprocessableCompletionManager = new CompletionManager ( this , "multiplexer" ) ;
917- serverSelectionStrategy = new ServerSelectionStrategy ( this ) ;
914+ UnprocessableCompletionManager = new CompletionManager ( this , "multiplexer" ) ;
915+ ServerSelectionStrategy = new ServerSelectionStrategy ( this ) ;
918916
919917 var configChannel = configuration . ConfigurationChannel ;
920918 if ( ! string . IsNullOrWhiteSpace ( configChannel ) )
@@ -975,7 +973,7 @@ internal long LastHeartbeatSecondsAgo
975973
976974 internal static long LastGlobalHeartbeatSecondsAgo => unchecked ( Environment . TickCount - VolatileWrapper . Read ( ref lastGlobalHeartbeatTicks ) ) / 1000 ;
977975
978- internal CompletionManager UnprocessableCompletionManager => unprocessableCompletionManager ;
976+ internal CompletionManager UnprocessableCompletionManager { get ; }
979977
980978 /// <summary>
981979 /// Obtain a pub/sub subscriber connection to the specified server
@@ -1086,8 +1084,6 @@ internal static void TraceWithoutContext(bool condition, string message, [Caller
10861084 if ( condition ) OnTraceWithoutContext ( message , category ) ;
10871085 }
10881086
1089- private readonly CompletionManager unprocessableCompletionManager ;
1090-
10911087 /// <summary>
10921088 /// The number of operations that have been performed on all connections
10931089 /// </summary>
@@ -1234,7 +1230,7 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text
12341230 if ( configuration . ResolveDns && configuration . HasDnsEndPoints ( ) )
12351231 {
12361232 var dns = configuration . ResolveEndPointsAsync ( this , log ) . ObserveErrors ( ) ;
1237- if ( ( await Task . WhenAny ( dns , Task . Delay ( timeoutMilliseconds ) ) . ForAwait ( ) ) != dns )
1233+ if ( ( await Task . WhenAny ( dns , Task . Delay ( TimeoutMilliseconds ) ) . ForAwait ( ) ) != dns )
12381234 {
12391235 throw new TimeoutException ( "Timeout resolving endpoints" ) ;
12401236 }
@@ -1443,15 +1439,15 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text
14431439 // set the serverSelectionStrategy
14441440 if ( RawConfig . Proxy == Proxy . Twemproxy )
14451441 {
1446- serverSelectionStrategy . ServerType = ServerType . Twemproxy ;
1442+ ServerSelectionStrategy . ServerType = ServerType . Twemproxy ;
14471443 }
14481444 else if ( standaloneCount == 0 && sentinelCount > 0 )
14491445 {
1450- serverSelectionStrategy . ServerType = ServerType . Sentinel ;
1446+ ServerSelectionStrategy . ServerType = ServerType . Sentinel ;
14511447 }
14521448 else
14531449 {
1454- serverSelectionStrategy . ServerType = ServerType . Standalone ;
1450+ ServerSelectionStrategy . ServerType = ServerType . Standalone ;
14551451 }
14561452 var preferred = await NominatePreferredMaster ( log , servers , useTieBreakers , tieBreakers , masters ) . ObserveErrors ( ) . ForAwait ( ) ;
14571453 foreach ( var master in masters )
@@ -1468,10 +1464,10 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text
14681464 }
14691465 else
14701466 {
1471- serverSelectionStrategy . ServerType = ServerType . Cluster ;
1472- long coveredSlots = serverSelectionStrategy . CountCoveredSlots ( ) ;
1467+ ServerSelectionStrategy . ServerType = ServerType . Cluster ;
1468+ long coveredSlots = ServerSelectionStrategy . CountCoveredSlots ( ) ;
14731469 LogLocked ( log , "Cluster: {0} of {1} slots covered" ,
1474- coveredSlots , serverSelectionStrategy . TotalSlots ) ;
1470+ coveredSlots , ServerSelectionStrategy . TotalSlots ) ;
14751471 }
14761472 if ( ! first )
14771473 {
@@ -1724,15 +1720,13 @@ internal void UpdateClusterRange(ClusterConfiguration configuration)
17241720 foreach ( var slot in node . Slots )
17251721 {
17261722 var server = GetServerEndPoint ( node . EndPoint ) ;
1727- if ( server != null ) serverSelectionStrategy . UpdateClusterRange ( slot . From , slot . To , server ) ;
1723+ if ( server != null ) ServerSelectionStrategy . UpdateClusterRange ( slot . From , slot . To , server ) ;
17281724 }
17291725 }
17301726 }
17311727
17321728 private Timer pulse ;
17331729
1734- private readonly ServerSelectionStrategy serverSelectionStrategy ;
1735-
17361730 internal ServerEndPoint [ ] GetServerSnapshot ( )
17371731 {
17381732 var tmp = serverSnapshot ;
@@ -1742,12 +1736,12 @@ internal ServerEndPoint[] GetServerSnapshot()
17421736 internal ServerEndPoint SelectServer ( Message message )
17431737 {
17441738 if ( message == null ) return null ;
1745- return serverSelectionStrategy . Select ( message ) ;
1739+ return ServerSelectionStrategy . Select ( message ) ;
17461740 }
17471741
17481742 internal ServerEndPoint SelectServer ( int db , RedisCommand command , CommandFlags flags , RedisKey key )
17491743 {
1750- return serverSelectionStrategy . Select ( db , command , key , flags ) ;
1744+ return ServerSelectionStrategy . Select ( db , command , key , flags ) ;
17511745 }
17521746
17531747 private bool TryPushMessageToBridge < T > ( Message message , ResultProcessor < T > processor , ResultBox < T > resultBox , ref ServerEndPoint server )
@@ -1855,7 +1849,7 @@ public bool IsConnecting
18551849
18561850 internal ConfigurationOptions RawConfig => configuration ;
18571851
1858- internal ServerSelectionStrategy ServerSelectionStrategy => serverSelectionStrategy ;
1852+ internal ServerSelectionStrategy ServerSelectionStrategy { get ; }
18591853
18601854 /// <summary>
18611855 /// Close all connections and release all resources associated with this object
@@ -2005,7 +1999,7 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
20051999 throw ExceptionFactory . NoConnectionAvailable ( IncludeDetailInExceptions , IncludePerformanceCountersInExceptions , message . Command , message , server , GetServerSnapshot ( ) ) ;
20062000 }
20072001
2008- if ( Monitor . Wait ( source , timeoutMilliseconds ) )
2002+ if ( Monitor . Wait ( source , TimeoutMilliseconds ) )
20092003 {
20102004 Trace ( "Timeley response to " + message ) ;
20112005 }
0 commit comments