Skip to content

Commit

Permalink
chore: Add CLIENT ID command (#3672)
Browse files Browse the repository at this point in the history
We already adhere to all requirements, we just need to return the id
when the command is issued :)

Fixes #3651
  • Loading branch information
chakaz authored Sep 8, 2024
1 parent 0e7c12f commit 1306a91
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/server/server_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,14 @@ void ClientCaching(CmdArgList args, ConnectionContext* cntx) {
cntx->SendOk();
}

void ClientId(CmdArgList args, ConnectionContext* cntx) {
if (args.size() != 0) {
return cntx->SendError(kSyntaxErr);
}

return cntx->SendLong(cntx->conn()->GetClientId());
}

void ClientKill(CmdArgList args, absl::Span<facade::Listener*> listeners, ConnectionContext* cntx) {
std::function<bool(facade::Connection * conn)> evaluator;

Expand Down Expand Up @@ -1762,6 +1770,8 @@ void ServerFamily::Client(CmdArgList args, ConnectionContext* cntx) {
return ClientKill(sub_args, absl::MakeSpan(listeners_), cntx);
} else if (sub_cmd == "CACHING") {
return ClientCaching(sub_args, cntx);
} else if (sub_cmd == "ID") {
return ClientId(sub_args, cntx);
}

if (sub_cmd == "SETINFO") {
Expand Down

0 comments on commit 1306a91

Please sign in to comment.