From 52d314c143a5516a8006322bf13d46bc2f18e8bd Mon Sep 17 00:00:00 2001 From: Rueian Date: Thu, 26 Dec 2024 00:29:25 +0800 Subject: [PATCH] Add availability_zone to the HELLO response Signed-off-by: Rueian --- src/networking.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/networking.c b/src/networking.c index d93046a603..4a27c9adbf 100644 --- a/src/networking.c +++ b/src/networking.c @@ -4195,7 +4195,7 @@ void helloCommand(client *c) { /* Let's switch to the specified RESP mode. */ if (ver) c->resp = ver; - addReplyMapLen(c, 6 + !server.sentinel_mode); + addReplyMapLen(c, 6 + !server.sentinel_mode + (sdslen(server.availability_zone) != 0)); addReplyBulkCString(c, "server"); addReplyBulkCString(c, server.extended_redis_compat ? "redis" : SERVER_NAME); @@ -4224,6 +4224,11 @@ void helloCommand(client *c) { addReplyBulkCString(c, "modules"); addReplyLoadedModules(c); + + if (sdslen(server.availability_zone) != 0) { + addReplyBulkCString(c, "availability_zone"); + addReplyBulkCBuffer(c, server.availability_zone, sdslen(server.availability_zone)); + } } /* This callback is bound to POST and "Host:" command names. Those are not