resetClient prepare the client to process the next command */
| 2131 | |
| 2132 | /* resetClient prepare the client to process the next command */ |
| 2133 | void 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 |
no test coverage detected