Skip to content

Commit

Permalink
Fix Bugs, Caused by Hello Respones Types microsoft#811
Browse files Browse the repository at this point in the history
  • Loading branch information
yuseok-kim-edushare committed Nov 22, 2024
1 parent c84c8c7 commit ba0dc33
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions libs/server/Resp/BasicCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,13 +1463,13 @@ void ProcessHelloCommand(byte? respProtocolVersion, ReadOnlySpan<byte> username,
this.clientName = clientName;
}

(string, string)[] helloResult =
(string, object)[] helloResult =
[
("server", "redis"),
("version", storeWrapper.redisProtocolVersion),
("garnet_version", storeWrapper.version),
("proto", $"{this.respProtocolVersion}"),
("id", "63"),
("proto", this.respProtocolVersion),
("id", 63),
("mode", storeWrapper.serverOptions.EnableCluster ? "cluster" : "standalone"),
("role", storeWrapper.serverOptions.EnableCluster && storeWrapper.clusterProvider.IsReplica() ? "replica" : "master"),
];
Expand All @@ -1488,8 +1488,16 @@ void ProcessHelloCommand(byte? respProtocolVersion, ReadOnlySpan<byte> username,
{
while (!RespWriteUtils.WriteAsciiBulkString(helloResult[i].Item1, ref dcurr, dend))
SendAndReset();
while (!RespWriteUtils.WriteAsciiBulkString(helloResult[i].Item2, ref dcurr, dend))
SendAndReset();
if (helloResult[i].Item2 is int intValue)
{
while (!RespWriteUtils.WriteInteger(intValue, ref dcurr, dend))
SendAndReset();
}
else
{
while (!RespWriteUtils.WriteAsciiBulkString(helloResult[i].Item2.ToString(), ref dcurr, dend))
SendAndReset();
}
}
while (!RespWriteUtils.WriteAsciiBulkString("modules", ref dcurr, dend))
SendAndReset();
Expand Down

0 comments on commit ba0dc33

Please sign in to comment.