Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add CLIENT ID command #3672

Merged
merged 1 commit into from
Sep 8, 2024
Merged
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
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
Loading