MCPcopy Create free account
hub / github.com/F-Stack/f-stack / resetClient

Function resetClient

app/redis-6.2.6/src/networking.c:1656–1683  ·  view source on GitHub ↗

resetClient prepare the client to process the next command */

Source from the content-addressed store, hash-verified

1654
1655/* resetClient prepare the client to process the next command */
1656void resetClient(client *c) {
1657 redisCommandProc *prevcmd = c->cmd ? c->cmd->proc : NULL;
1658
1659 freeClientArgv(c);
1660 c->reqtype = 0;
1661 c->multibulklen = 0;
1662 c->bulklen = -1;
1663
1664 /* We clear the ASKING flag as well if we are not inside a MULTI, and
1665 * if what we just executed is not the ASKING command itself. */
1666 if (!(c->flags & CLIENT_MULTI) && prevcmd != askingCommand)
1667 c->flags &= ~CLIENT_ASKING;
1668
1669 /* We do the same for the CACHING command as well. It also affects
1670 * the next command or transaction executed, in a way very similar
1671 * to ASKING. */
1672 if (!(c->flags & CLIENT_MULTI) && prevcmd != clientCommand)
1673 c->flags &= ~CLIENT_TRACKING_CACHING;
1674
1675 /* Remove the CLIENT_REPLY_SKIP flag if any so that the reply
1676 * to the next command will be sent, but set the flag if the command
1677 * we just processed was "CLIENT REPLY SKIP". */
1678 c->flags &= ~CLIENT_REPLY_SKIP;
1679 if (c->flags & CLIENT_REPLY_SKIP_NEXT) {
1680 c->flags |= CLIENT_REPLY_SKIP;
1681 c->flags &= ~CLIENT_REPLY_SKIP_NEXT;
1682 }
1683}
1684
1685/* This function is used when we want to re-enter the event loop but there
1686 * is the risk that the client we are dealing with will be freed in some

Callers 5

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

Calls 1

freeClientArgvFunction · 0.85

Tested by

no test coverage detected