Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/server/server_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ void ClientGetName(CmdArgList args, SinkReplyBuilder* builder, ConnectionContext
}
}

void ClientInfo(CmdArgList args, SinkReplyBuilder* builder, ConnectionContext* cntx) {
if (!args.empty()) {
return builder->SendError(facade::kSyntaxErr);
}
auto* conn = cntx->conn();
string info = conn->GetClientInfo();
auto* rb = static_cast<RedisReplyBuilder*>(builder);
return rb->SendVerbatimString(info);
}

void ClientList(CmdArgList args, absl::Span<facade::Listener*> listeners, SinkReplyBuilder* builder,
ConnectionContext* cntx) {
if (!args.empty()) {
Expand Down Expand Up @@ -2272,6 +2282,8 @@ void ClientHelp(SinkReplyBuilder* builder) {
" Kill connections made to specified local address",
" * ID <client-id>",
" Kill connections by client id.",
"INFO",
" Return information about the current client connection.",
"LIST",
" Return information about client connections.",
"UNPAUSE",
Expand Down Expand Up @@ -2304,6 +2316,8 @@ void ServerFamily::Client(CmdArgList args, const CommandContext& cmd_cntx) {
return ClientSetName(sub_args, builder, cntx);
} else if (sub_cmd == "GETNAME") {
return ClientGetName(sub_args, builder, cntx);
} else if (sub_cmd == "INFO") {
return ClientInfo(sub_args, builder, cntx);
} else if (sub_cmd == "LIST") {
return ClientList(sub_args, absl::MakeSpan(listeners_), builder, cntx);
} else if (sub_cmd == "PAUSE") {
Expand Down
Loading