Commit 6ed17a99 authored by Marc Gravell's avatar Marc Gravell

WILL NEED TO REVERT: pong ident (breaks RedisLabs)

parent 82d2ac49
......@@ -240,13 +240,13 @@ internal void KeepAlive()
switch (ConnectionType)
{
case ConnectionType.Interactive:
msg = ServerEndPoint.GetTracerMessage(false);
msg = ServerEndPoint.GetTracerMessage(false, "pong hb");
msg.SetSource(ResultProcessor.Tracer, null);
break;
case ConnectionType.Subscription:
if (commandMap.IsAvailable(RedisCommand.PING) && ServerEndPoint.GetFeatures().PingOnSubscriber)
{
msg = Message.Create(-1, CommandFlags.FireAndForget, RedisCommand.PING);
msg = Message.Create(-1, CommandFlags.FireAndForget, RedisCommand.PING, (RedisValue)"pong sub");
msg.SetSource(ResultProcessor.Tracer, null);
}
else if (commandMap.IsAvailable(RedisCommand.UNSUBSCRIBE))
......
......@@ -103,7 +103,7 @@ private ResultProcessor.TimingProcessor.TimerMessage GetTimerMessage(CommandFlag
// do the best we can with available commands
var map = multiplexer.CommandMap;
if(map.IsAvailable(RedisCommand.PING))
return ResultProcessor.TimingProcessor.CreateMessage(-1, flags, RedisCommand.PING);
return ResultProcessor.TimingProcessor.CreateMessage(-1, flags, RedisCommand.PING, "pong time");
if(map.IsAvailable(RedisCommand.TIME))
return ResultProcessor.TimingProcessor.CreateMessage(-1, flags, RedisCommand.TIME);
if (map.IsAvailable(RedisCommand.ECHO))
......
......@@ -555,13 +555,13 @@ public Task HyperLogLogMergeAsync(RedisKey destination, RedisKey[] sourceKeys, C
public EndPoint IdentifyEndpoint(RedisKey key = default(RedisKey), CommandFlags flags = CommandFlags.None)
{
var msg = key.IsNull ? Message.Create(-1, flags, RedisCommand.PING) : Message.Create(Database, flags, RedisCommand.EXISTS, key);
var msg = key.IsNull ? Message.Create(-1, flags, RedisCommand.PING, (RedisValue)"pong ident") : Message.Create(Database, flags, RedisCommand.EXISTS, key);
return ExecuteSync(msg, ResultProcessor.ConnectionIdentity);
}
public Task<EndPoint> IdentifyEndpointAsync(RedisKey key = default(RedisKey), CommandFlags flags = CommandFlags.None)
{
var msg = key.IsNull ? Message.Create(-1, flags, RedisCommand.PING) : Message.Create(Database, flags, RedisCommand.EXISTS, key);
var msg = key.IsNull ? Message.Create(-1, flags, RedisCommand.PING, (RedisValue)"pong ident") : Message.Create(Database, flags, RedisCommand.EXISTS, key);
return ExecuteAsync(msg, ResultProcessor.ConnectionIdentity);
}
......
......@@ -17,14 +17,21 @@ public static readonly CommandBytes
no = "no",
OK = "OK",
one = "1",
PONG = "PONG",
QUEUED = "QUEUED",
READONLY = "READONLY ",
slave_read_only = "slave-read-only",
timeout = "timeout",
wildcard = "*",
yes = "yes",
zero = "0";
zero = "0",
pong_sub = "pong sub",
pong_hb = "pong hb",
pong_test = "pong test",
pong_time = "pong time",
pong_tran = "pong tran",
PONG = "PONG";
}
internal static class RedisLiterals
{
......
......@@ -122,8 +122,8 @@ private Message CreateMessage(CommandFlags flags, out ResultProcessor<bool> proc
processor = null;
return null; // they won't notice if we don't do anything...
}
processor = ResultProcessor.DemandPONG;
return Message.Create(-1, flags, RedisCommand.PING);
processor = ResultProcessor.DemandPONG_TRAN;
return Message.Create(-1, flags, RedisCommand.PING, (RedisValue)"pong tran");
}
processor = TransactionProcessor.Default;
return new TransactionMessage(Database, flags, cond, work);
......
......@@ -15,7 +15,7 @@ internal abstract class ResultProcessor
public static readonly ResultProcessor<bool>
Boolean = new BooleanProcessor(),
DemandOK = new ExpectBasicStringProcessor(CommonReplies.OK),
DemandPONG = new ExpectBasicStringProcessor(CommonReplies.PONG),
DemandPONG_TRAN = new ExpectBasicStringProcessor(CommonReplies.pong_tran),
DemandZeroOrOne = new DemandZeroOrOneProcessor(),
AutoConfigure = new AutoConfigureProcessor(),
TrackSubscriptions = new TrackSubscriptionsProcessor(),
......@@ -1827,10 +1827,13 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
happy = result.Type == ResultType.BulkString && (!establishConnection || result.IsEqual(connection.BridgeCouldBeNull?.Multiplexer?.UniqueId));
break;
case RedisCommand.PING:
// there are two different PINGs; "interactive" is a +PONG or +{your message},
// there are two different PINGs; "interactive" is a +PONG or ${your message},
// but subscriber returns a bulk-array of [ "pong", {your message} ]
switch (result.Type)
{
case ResultType.BulkString:
happy = result.IsEqual(CommonReplies.pong_hb) || result.IsEqual(CommonReplies.pong_test);
break;
case ResultType.SimpleString:
happy = result.IsEqual(CommonReplies.PONG);
break;
......@@ -1838,7 +1841,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
if (result.ItemsCount == 2)
{
var items = result.GetItems();
happy = items[0].IsEqual(CommonReplies.PONG) && items[1].Payload.IsEmpty;
happy = items[0].IsEqual(CommonReplies.PONG) && items[1].IsEqual(CommonReplies.pong_sub);
}
else
{
......
......@@ -411,7 +411,7 @@ internal string GetStormLog(RedisCommand command)
return bridge?.GetStormLog();
}
internal Message GetTracerMessage(bool assertIdentity)
internal Message GetTracerMessage(bool assertIdentity, string preferredMessage)
{
// different configurations block certain commands, as can ad-hoc local configurations, so
// we'll do the best with what we have available.
......@@ -426,7 +426,7 @@ internal Message GetTracerMessage(bool assertIdentity)
}
else if (map.IsAvailable(RedisCommand.PING))
{
msg = Message.Create(-1, flags, RedisCommand.PING);
msg = Message.Create(-1, flags, RedisCommand.PING, (RedisValue)preferredMessage);
}
else if (map.IsAvailable(RedisCommand.TIME))
{
......@@ -586,7 +586,7 @@ internal void ReportNextFailure()
internal Task<bool> SendTracer(TextWriter log = null)
{
var msg = GetTracerMessage(false);
var msg = GetTracerMessage(false, "pong test");
msg = LoggingMessage.Create(log, msg);
return WriteDirectAsync(msg, ResultProcessor.Tracer);
}
......@@ -704,7 +704,7 @@ private Task HandshakeAsync(PhysicalConnection connection, TextWriter log)
AutoConfigure(connection);
}
Multiplexer.LogLocked(log, "Sending critical tracer: {0}", bridge);
var tracer = GetTracerMessage(true);
var tracer = GetTracerMessage(true, "pong test");
tracer = LoggingMessage.Create(log, tracer);
WriteDirectOrQueueFireAndForget(connection, tracer, ResultProcessor.EstablishConnection);
......
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