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
| 1504 | * client object. Other contexts without associated clients are the ones |
| 1505 | * initialized to run the timers callbacks. */ |
| 1506 | client *moduleGetReplyClient(RedisModuleCtx *ctx) { |
| 1507 | if (ctx->flags & REDISMODULE_CTX_THREAD_SAFE) { |
| 1508 | if (ctx->blocked_client) |
| 1509 | return ctx->blocked_client->reply_client; |
| 1510 | else |
| 1511 | return NULL; |
| 1512 | } else { |
| 1513 | /* If this is a non thread safe context, just return the client |
| 1514 | * that is running the command if any. This may be NULL as well |
| 1515 | * in the case of contexts that are not executed with associated |
| 1516 | * clients, like timer contexts. */ |
| 1517 | return ctx->client; |
| 1518 | } |
| 1519 | } |
| 1520 | |
| 1521 | /* Send an integer reply to the client, with the specified long long value. |
| 1522 | * The function always returns REDISMODULE_OK. */ |
no outgoing calls
no test coverage detected