| 7649 | } |
| 7650 | |
| 7651 | void moduleCallCommandFilters(client *c) { |
| 7652 | if (listLength(moduleCommandFilters) == 0) return; |
| 7653 | |
| 7654 | listIter li; |
| 7655 | listNode *ln; |
| 7656 | listRewind(moduleCommandFilters,&li); |
| 7657 | |
| 7658 | RedisModuleCommandFilterCtx filter = { c->argv, c->argc }; |
| 7659 | |
| 7660 | while((ln = listNext(&li))) { |
| 7661 | RedisModuleCommandFilter *f = (RedisModuleCommandFilter*)ln->value; |
| 7662 | |
| 7663 | /* Skip filter if REDISMODULE_CMDFILTER_NOSELF is set and module is |
| 7664 | * currently processing a command. |
| 7665 | */ |
| 7666 | if ((f->flags & REDISMODULE_CMDFILTER_NOSELF) && f->module->in_call) continue; |
| 7667 | |
| 7668 | /* Call filter */ |
| 7669 | f->callback(&filter); |
| 7670 | } |
| 7671 | |
| 7672 | c->argv = filter.argv; |
| 7673 | c->argc = filter.argc; |
| 7674 | } |
| 7675 | |
| 7676 | /* Return the number of arguments a filtered command has. The number of |
| 7677 | * arguments include the command itself. |
no test coverage detected