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

Function replaceClientCommandVector

src/networking.cpp:3752–3765  ·  view source on GitHub ↗

Completely replace the client command vector with the provided one. */

Source from the content-addressed store, hash-verified

3750
3751/* Completely replace the client command vector with the provided one. */
3752void replaceClientCommandVector(client *c, int argc, robj **argv) {
3753 int j;
3754 retainOriginalCommandVector(c);
3755 freeClientArgv(c);
3756 zfree(c->argv);
3757 c->argv = argv;
3758 c->argc = argc;
3759 c->argv_len_sumActive = 0;
3760 for (j = 0; j < c->argc; j++)
3761 if (c->argv[j])
3762 c->argv_len_sumActive += getStringObjectLen(c->argv[j]);
3763 c->cmd = lookupCommandOrOriginal((sds)ptrFromObj(c->argv[0]));
3764 serverAssertWithInfo(c,NULL,c->cmd != NULL);
3765}
3766
3767/* Rewrite a single item in the command vector.
3768 * The new val ref count is incremented, and the old decremented.

Callers 4

migrateCommandFunction · 0.85
geoaddCommandFunction · 0.85
setGenericCommandFunction · 0.85

Calls 6

freeClientArgvFunction · 0.85
zfreeFunction · 0.85
getStringObjectLenFunction · 0.85
lookupCommandOrOriginalFunction · 0.85
ptrFromObjFunction · 0.85

Tested by

no test coverage detected