Commit 76326ba6 authored by Nick Craver's avatar Nick Craver

Better fix for TestQuit

Lines up with behaviors elsewhere - we already have semantics for failures here...following along.
parent bf0a037d
......@@ -547,7 +547,7 @@ internal WriteResult WriteMessageTakingWriteLock(PhysicalConnection physical, Me
{
result = WriteMessageToServerInsideWriteLock(physical, next);
}
physical.WakeWriterAndCheckForThrottle();
result = physical.WakeWriterAndCheckForThrottle();
}
finally
{
......
......@@ -270,9 +270,8 @@ public Task FlushAsync()
return Task.CompletedTask;
}
public Exception RecordConnectionFailed(ConnectionFailureType failureType, Exception innerException = null, [CallerMemberName] string origin = null)
public void RecordConnectionFailed(ConnectionFailureType failureType, Exception innerException = null, [CallerMemberName] string origin = null)
{
Exception ex = innerException;
IdentifyFailureType(innerException, ref failureType);
if (failureType == ConnectionFailureType.InternalFailure) OnInternalError(innerException, origin);
......@@ -331,7 +330,7 @@ void add(string lk, string sk, string v)
add("Last-Global-Heartbeat", "global", ConnectionMultiplexer.LastGlobalHeartbeatSecondsAgo + "s ago");
}
ex = innerException == null
var ex = innerException == null
? new RedisConnectionException(failureType, exMessage.ToString())
: new RedisConnectionException(failureType, exMessage.ToString(), innerException);
......@@ -358,7 +357,6 @@ void add(string lk, string sk, string v)
// burn the socket
Shutdown();
return ex;
}
public override string ToString()
......@@ -702,16 +700,18 @@ internal static int WriteRaw(Span<byte> span, long value, bool withLengthPrefix
return WriteCrlf(span, offset);
}
internal void WakeWriterAndCheckForThrottle()
internal WriteResult WakeWriterAndCheckForThrottle()
{
try
{
var flush = _ioPipe.Output.FlushAsync();
if (!flush.IsCompletedSuccessfully) flush.AsTask().Wait();
return WriteResult.Success;
}
catch (ConnectionResetException ex)
{
throw RecordConnectionFailed(ConnectionFailureType.SocketClosed, ex);
RecordConnectionFailed(ConnectionFailureType.SocketClosed, ex);
return WriteResult.WriteFailure;
}
}
......
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