MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / moduleCallClusterReceivers

Function moduleCallClusterReceivers

src/module.cpp:6187–6201  ·  view source on GitHub ↗

Dispatch the message to the right module receiver. */

Source from the content-addressed store, hash-verified

6185
6186/* Dispatch the message to the right module receiver. */
6187void 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

Callers 1

clusterProcessPacketFunction · 0.85

Calls 2

selectDbFunction · 0.85
moduleFreeContextFunction · 0.85

Tested by

no test coverage detected