summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-10-22 16:50:52 +0200
committerantirez <antirez@gmail.com>2019-10-23 18:39:53 +0200
commitc379fdbae2d01f0a44ef33e47adfebeaf86a13f8 (patch)
tree28c06635ee5a7e95d4fbdf3d506405b1a30b06e2
parentcf52e0ad446638fd4ae64e035c52001a98b1e415 (diff)
downloadredis-c379fdbae2d01f0a44ef33e47adfebeaf86a13f8.tar.gz
Modules hooks: do more in example client callback.
-rw-r--r--src/modules/hellohook.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/modules/hellohook.c b/src/modules/hellohook.c
index ec3c9d264..ea0ac517d 100644
--- a/src/modules/hellohook.c
+++ b/src/modules/hellohook.c
@@ -41,8 +41,13 @@
void clientChangeCallback(RedisModuleCtx *ctx, RedisModuleEvent e, uint64_t sub, void *data)
{
REDISMODULE_NOT_USED(ctx);
+ REDISMODULE_NOT_USED(e);
+
RedisModuleClientInfo *ci = data;
- printf("Client event for client #%llu %s:%d\n",ci->id,ci->addr,ci->port);
+ printf("Client %s event for client #%llu %s:%d\n",
+ (sub == REDISMODULE_SUBEVENT_CLIENT_CHANGE_CONNECTED) ?
+ "connection" : "disconnection",
+ ci->id,ci->addr,ci->port);
}
/* This function must be present on each Redis module. It is used in order to