Commit d5fff16f authored by Nick Craver's avatar Nick Craver

Cleanup: ServerEndpoint

parent 170bbca5
...@@ -321,7 +321,7 @@ internal void AutoConfigure(PhysicalConnection connection) ...@@ -321,7 +321,7 @@ internal void AutoConfigure(PhysicalConnection connection)
private int _nextReplicaOffset; private int _nextReplicaOffset;
internal uint NextReplicaOffset() // used to round-robin between multiple replicas internal uint NextReplicaOffset() // used to round-robin between multiple replicas
=> (uint) System.Threading.Interlocked.Increment(ref _nextReplicaOffset); => (uint)System.Threading.Interlocked.Increment(ref _nextReplicaOffset);
internal Task Close() internal Task Close()
{ {
...@@ -393,11 +393,11 @@ internal string GetProfile() ...@@ -393,11 +393,11 @@ internal string GetProfile()
internal byte[] GetScriptHash(string script, RedisCommand command) internal byte[] GetScriptHash(string script, RedisCommand command)
{ {
var found = (byte[])knownScripts[script]; var found = (byte[])knownScripts[script];
if(found == null && command == RedisCommand.EVALSHA) if (found == null && command == RedisCommand.EVALSHA)
{ {
// the script provided is a hex sha; store and re-use the ascii for that // the script provided is a hex sha; store and re-use the ascii for that
found = Encoding.ASCII.GetBytes(script); found = Encoding.ASCII.GetBytes(script);
lock(knownScripts) lock (knownScripts)
{ {
knownScripts[script] = found; knownScripts[script] = found;
} }
...@@ -581,14 +581,15 @@ internal string Summary() ...@@ -581,14 +581,15 @@ internal string Summary()
var tmp = interactive; var tmp = interactive;
sb.Append("; int: ").Append(tmp?.ConnectionState.ToString() ?? "n/a"); sb.Append("; int: ").Append(tmp?.ConnectionState.ToString() ?? "n/a");
tmp = subscription; tmp = subscription;
if(tmp == null) if (tmp == null)
{ {
sb.Append("; sub: n/a"); sb.Append("; sub: n/a");
} else }
else
{ {
var state = tmp.ConnectionState; var state = tmp.ConnectionState;
sb.Append("; sub: ").Append(state); sb.Append("; sub: ").Append(state);
if(state == PhysicalBridge.State.ConnectedEstablished) if (state == PhysicalBridge.State.ConnectedEstablished)
{ {
sb.Append(", ").Append(tmp.SubscriptionCount).Append(" active"); sb.Append(", ").Append(tmp.SubscriptionCount).Append(" active");
} }
...@@ -678,7 +679,7 @@ private void Handshake(PhysicalConnection connection, TextWriter log) ...@@ -678,7 +679,7 @@ private void Handshake(PhysicalConnection connection, TextWriter log)
if (connType == ConnectionType.Subscription) if (connType == ConnectionType.Subscription)
{ {
var configChannel = multiplexer.ConfigurationChangedChannel; var configChannel = multiplexer.ConfigurationChangedChannel;
if(configChannel != null) if (configChannel != null)
{ {
msg = Message.Create(-1, CommandFlags.FireAndForget, RedisCommand.SUBSCRIBE, (RedisChannel)configChannel); msg = Message.Create(-1, CommandFlags.FireAndForget, RedisCommand.SUBSCRIBE, (RedisChannel)configChannel);
WriteDirectOrQueueFireAndForget(connection, msg, ResultProcessor.TrackSubscriptions); WriteDirectOrQueueFireAndForget(connection, msg, ResultProcessor.TrackSubscriptions);
...@@ -690,7 +691,7 @@ private void Handshake(PhysicalConnection connection, TextWriter log) ...@@ -690,7 +691,7 @@ private void Handshake(PhysicalConnection connection, TextWriter log)
private void SetConfig<T>(ref T field, T value, [CallerMemberName] string caller = null) private void SetConfig<T>(ref T field, T value, [CallerMemberName] string caller = null)
{ {
if(!EqualityComparer<T>.Default.Equals(field, value)) if (!EqualityComparer<T>.Default.Equals(field, value))
{ {
multiplexer.Trace(caller + " changed from " + field + " to " + value, "Configuration"); multiplexer.Trace(caller + " changed from " + field + " to " + value, "Configuration");
field = value; field = value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment