Return the client object the `RM_Reply*` functions should target. * Normally this is just `ctx->client`, that is the client that called * the module command, however in the case of thread safe contexts there * is no directly associated client (since it would not be safe to access * the client from a thread), so instead the blocked client object referenced * in the thread safe context, has a f
| 1477 | * client object. Other contexts without associated clients are the ones |
| 1478 | * initialized to run the timers callbacks. */ |
| 1479 | client *moduleGetReplyClient(RedisModuleCtx *ctx) { |
| 1480 | if (ctx->flags & REDISMODULE_CTX_THREAD_SAFE) { |
| 1481 | if (ctx->blocked_client) |
| 1482 | return ctx->blocked_client->reply_client; |
| 1483 | else |
| 1484 | return NULL; |
| 1485 | } else { |
| 1486 | /* If this is a non thread safe context, just return the client |
| 1487 | * that is running the command if any. This may be NULL as well |
| 1488 | * in the case of contexts that are not executed with associated |
| 1489 | * clients, like timer contexts. */ |
| 1490 | return ctx->client; |
| 1491 | } |
| 1492 | } |
| 1493 | |
| 1494 | /* Send an integer reply to the client, with the specified long long value. |
| 1495 | * The function always returns REDISMODULE_OK. */ |
no outgoing calls
no test coverage detected