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

Function resetClient

src/networking.cpp:2133–2157  ·  view source on GitHub ↗

resetClient prepare the client to process the next command */

Source from the content-addressed store, hash-verified

2131
2132/* resetClient prepare the client to process the next command */
2133void resetClient(client *c) {
2134 redisCommandProc *prevcmd = c->cmd ? c->cmd->proc : NULL;
2135
2136 freeClientArgv(c);
2137
2138 /* We clear the ASKING flag as well if we are not inside a MULTI, and
2139 * if what we just executed is not the ASKING command itself. */
2140 if (!(c->flags & CLIENT_MULTI) && prevcmd != askingCommand)
2141 c->flags &= ~CLIENT_ASKING;
2142
2143 /* We do the same for the CACHING command as well. It also affects
2144 * the next command or transaction executed, in a way very similar
2145 * to ASKING. */
2146 if (!(c->flags & CLIENT_MULTI) && prevcmd != clientCommand)
2147 c->flags &= ~CLIENT_TRACKING_CACHING;
2148
2149 /* Remove the CLIENT_REPLY_SKIP flag if any so that the reply
2150 * to the next command will be sent, but set the flag if the command
2151 * we just processed was "CLIENT REPLY SKIP". */
2152 c->flags &= ~CLIENT_REPLY_SKIP;
2153 if (c->flags & CLIENT_REPLY_SKIP_NEXT) {
2154 c->flags |= CLIENT_REPLY_SKIP;
2155 c->flags &= ~CLIENT_REPLY_SKIP_NEXT;
2156 }
2157}
2158
2159/* This function is used when we want to re-enter the event loop but there
2160 * is the risk that the client we are dealing with will be freed in some

Callers 6

replicationCacheMasterFunction · 0.70
unblockClientFunction · 0.70
RM_CallFunction · 0.70
executeCronJobExpireHookFunction · 0.70
commandProcessedFunction · 0.70
processInputBufferFunction · 0.70

Calls 1

freeClientArgvFunction · 0.85

Tested by

no test coverage detected