Commit 166c2bd0 authored by Marc Gravell's avatar Marc Gravell

make sure that as many places as possible see PhysicalConnection's state (via...

make sure that as many places as possible see PhysicalConnection's state (via ToString(), rather than physicalName)
parent b2c05dec
......@@ -42,7 +42,7 @@ private static readonly Message
// things sent to this physical, but not yet received
private readonly Queue<Message> _writtenAwaitingResponse = new Queue<Message>();
private readonly string physicalName;
private readonly string _physicalName;
private volatile int currentDatabase = 0;
......@@ -67,7 +67,7 @@ public PhysicalConnection(PhysicalBridge bridge)
ChannelPrefix = bridge.Multiplexer.RawConfig.ChannelPrefix;
if (ChannelPrefix?.Length == 0) ChannelPrefix = null; // null tests are easier than null+empty
var endpoint = bridge.ServerEndPoint.EndPoint;
physicalName = connectionType + "#" + Interlocked.Increment(ref totalCount) + "@" + Format.ToString(endpoint);
_physicalName = connectionType + "#" + Interlocked.Increment(ref totalCount) + "@" + Format.ToString(endpoint);
OnCreateEcho();
}
......@@ -218,7 +218,7 @@ private enum ReadMode : byte
private bool IncludeDetailInExceptions => BridgeCouldBeNull?.Multiplexer.IncludeDetailInExceptions ?? false;
[Conditional("VERBOSE")]
internal void Trace(string message) => BridgeCouldBeNull?.Multiplexer?.Trace(message, physicalName);
internal void Trace(string message) => BridgeCouldBeNull?.Multiplexer?.Trace(message, ToString());
public long SubscriptionCount { get; set; }
......@@ -431,7 +431,7 @@ private enum WriteStatus
/// <summary>Returns a string that represents the current object.</summary>
/// <returns>A string that represents the current object.</returns>
public override string ToString() => $"{physicalName} ({_writeStatus})";
public override string ToString() => $"{_physicalName} ({_writeStatus})";
internal static void IdentifyFailureType(Exception exception, ref ConnectionFailureType failureType)
{
......@@ -654,7 +654,7 @@ internal static void WriteBulkString(RedisValue value, PipeWriter output)
internal void WriteHeader(RedisCommand command, int arguments, CommandBytes commandBytes = default)
{
var bridge = BridgeCouldBeNull;
if (bridge == null) throw new ObjectDisposedException(physicalName);
if (bridge == null) throw new ObjectDisposedException(ToString());
if (command == RedisCommand.UNKNOWN)
{
......@@ -1190,7 +1190,7 @@ internal async ValueTask<bool> ConnectedAsync(Socket socket, TextWriter log, Soc
{
pipe = SocketConnection.Create(socket, manager.SendPipeOptions, manager.ReceivePipeOptions, name: bridge.Name);
}
OnWrapForLogging(ref pipe, physicalName, manager);
OnWrapForLogging(ref pipe, _physicalName, manager);
_ioPipe = pipe;
......@@ -1202,7 +1202,7 @@ internal async ValueTask<bool> ConnectedAsync(Socket socket, TextWriter log, Soc
catch (Exception ex)
{
RecordConnectionFailed(ConnectionFailureType.InternalFailure, ex, isInitialConnect: true, connectingPipe: pipe); // includes a bridge.OnDisconnected
bridge.Multiplexer.Trace("Could not connect: " + ex.Message, physicalName);
bridge.Multiplexer.Trace("Could not connect: " + ex.Message, ToString());
return false;
}
}
......
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