MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / clientCommand

Function clientCommand

src/networking.cpp:3050–3608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3048}
3049
3050void clientCommand(client *c) {
3051 listNode *ln;
3052 listIter li;
3053
3054 if (c->argc == 2 && !strcasecmp((const char*)ptrFromObj(c->argv[1]),"help")) {
3055 const char *help[] = {
3056"CACHING (YES|NO)",
3057" Enable/disable tracking of the keys for next command in OPTIN/OPTOUT modes.",
3058"GETREDIR",
3059" Return the client ID we are redirecting to when tracking is enabled.",
3060"GETNAME",
3061" Return the name of the current connection.",
3062"ID",
3063" Return the ID of the current connection.",
3064"INFO",
3065" Return information about the current client connection.",
3066"KILL <ip:port>",
3067" Kill connection made from <ip:port>.",
3068"KILL <option> <value> [<option> <value> [...]]",
3069" Kill connections. Options are:",
3070" * ADDR (<ip:port>|<unixsocket>:0)",
3071" Kill connections made from the specified address",
3072" * LADDR (<ip:port>|<unixsocket>:0)",
3073" Kill connections made to specified local address",
3074" * TYPE (normal|master|replica|pubsub)",
3075" Kill connections by type.",
3076" * USER <username>",
3077" Kill connections authenticated by <username>.",
3078" * SKIPME (YES|NO)",
3079" Skip killing current connection (default: yes).",
3080"LIST [options ...]",
3081" Return information about client connections. Options:",
3082" * TYPE (NORMAL|MASTER|REPLICA|PUBSUB)",
3083" Return clients of specified type.",
3084"UNPAUSE",
3085" Stop the current client pause, resuming traffic.",
3086"PAUSE <timeout> [WRITE|ALL]",
3087" Suspend all, or just write, clients for <timout> milliseconds.",
3088"REPLY (ON|OFF|SKIP)",
3089" Control the replies sent to the current connection.",
3090"SETNAME <name>",
3091" Assign the name <name> to the current connection.",
3092"UNBLOCK <clientid> [TIMEOUT|ERROR]",
3093" Unblock the specified blocked client.",
3094"TRACKING (ON|OFF) [REDIRECT <id>] [BCAST] [PREFIX <prefix> [...]]",
3095" [OPTIN] [OPTOUT]",
3096" Control server assisted client side caching.",
3097"TRACKINGINFO",
3098" Report tracking status for the current connection.",
3099NULL
3100 };
3101 addReplyHelp(c, help);
3102 } else if (!strcasecmp((const char*)ptrFromObj(c->argv[1]),"id") && c->argc == 2) {
3103 /* CLIENT ID */
3104 addReplyLongLong(c,c->id);
3105 } else if (!strcasecmp(szFromObj(c->argv[1]),"info") && c->argc == 2) {
3106 /* CLIENT INFO */
3107 sds o = catClientInfoString(sdsempty(), c);

Callers

nothing calls this directly

Calls 15

ptrFromObjFunction · 0.85
addReplyHelpFunction · 0.85
addReplyLongLongFunction · 0.85
szFromObjFunction · 0.85
catClientInfoStringFunction · 0.85
sdsemptyFunction · 0.85
sdscatlenFunction · 0.85
addReplyVerbatimFunction · 0.85
sdslenFunction · 0.85
sdsfreeFunction · 0.85
getClientTypeByNameFunction · 0.85
addReplyErrorFormatFunction · 0.85

Tested by

no test coverage detected