resetClient prepare the client to process the next command */
| 1654 | |
| 1655 | /* resetClient prepare the client to process the next command */ |
| 1656 | void 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 |
no test coverage detected