Dispatch the message to the right module receiver. */
| 6185 | |
| 6186 | /* Dispatch the message to the right module receiver. */ |
| 6187 | void moduleCallClusterReceivers(const char *sender_id, uint64_t module_id, uint8_t type, const unsigned char *payload, uint32_t len) { |
| 6188 | moduleClusterReceiver *r = clusterReceivers[type]; |
| 6189 | while(r) { |
| 6190 | if (r->module_id == module_id) { |
| 6191 | RedisModuleCtx ctx = REDISMODULE_CTX_INIT; |
| 6192 | ctx.module = r->module; |
| 6193 | ctx.client = moduleFreeContextReusedClient; |
| 6194 | selectDb(ctx.client, 0); |
| 6195 | r->callback(&ctx,sender_id,type,payload,len); |
| 6196 | moduleFreeContext(&ctx); |
| 6197 | return; |
| 6198 | } |
| 6199 | r = r->next; |
| 6200 | } |
| 6201 | } |
| 6202 | |
| 6203 | /* Register a callback receiver for cluster messages of type 'type'. If there |
| 6204 | * was already a registered callback, this will replace the callback function |
no test coverage detected