summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-10-22 16:50:52 +0200
committerantirez <antirez@gmail.com>2019-10-22 16:50:52 +0200
commitf5318c719f8b16e61ccff79b2bb671ba7c7a4641 (patch)
treeed7e48219f44bda976cabc51daf1f8ca1945b25c
parent6d4e7127b48e24cbfbca706bc31088598d339b70 (diff)
downloadredis-f5318c719f8b16e61ccff79b2bb671ba7c7a4641.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