Commit a4f4e8ee authored by deepakv's avatar deepakv

StackExchange.Redis to consider separately Response Array as either NULL or an Empty Array.

parent d994b7ad
......@@ -877,9 +877,16 @@ private RawResult ReadArray(byte[] buffer, ref int offset, ref int count)
long i64;
if (!itemCount.TryGetInt64(out i64)) throw ExceptionFactory.ConnectionFailure(multiplexer.IncludeDetailInExceptions, ConnectionFailureType.ProtocolFailure, "Invalid array length", bridge.ServerEndPoint);
int itemCountActual = checked((int)i64);
if (itemCountActual <= 0) return RawResult.EmptyArray;
if (itemCountActual < 0)
{
//for null response by command like EXEC, RESP array: *-1\r\n
return new RawResult(ResultType.SimpleString, null, 0, 0);
}
else if (itemCountActual == 0)
{
//for zero array response by command like SCAN, Resp array: *0\r\n
return RawResult.EmptyArray;
}
var arr = new RawResult[itemCountActual];
for (int i = 0; i < itemCountActual; i++)
{
......
......@@ -416,6 +416,19 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
SetResult(message, false);
return true;
}
//EXEC returned with a NULL
if (!tran.IsAborted && result.IsNull)
{
connection.Multiplexer.Trace("Server aborted due to failed EXEC");
//cancel the commands in the transaction and mark them as complete with the completion manager
foreach (var op in wrapped)
{
op.Wrapped.Cancel();
bridge.CompleteSyncOrAsync(op.Wrapped);
}
SetResult(message, false);
return true;
}
break;
case ResultType.MultiBulk:
if (!tran.IsAborted)
......
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