Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c379fdba
Commit
c379fdba
authored
Oct 22, 2019
by
antirez
Browse files
Modules hooks: do more in example client callback.
parent
cf52e0ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/modules/hellohook.c
View file @
c379fdba
...
@@ -41,8 +41,13 @@
...
@@ -41,8 +41,13 @@
void
clientChangeCallback
(
RedisModuleCtx
*
ctx
,
RedisModuleEvent
e
,
uint64_t
sub
,
void
*
data
)
void
clientChangeCallback
(
RedisModuleCtx
*
ctx
,
RedisModuleEvent
e
,
uint64_t
sub
,
void
*
data
)
{
{
REDISMODULE_NOT_USED
(
ctx
);
REDISMODULE_NOT_USED
(
ctx
);
REDISMODULE_NOT_USED
(
e
);
RedisModuleClientInfo
*
ci
=
data
;
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
/* This function must be present on each Redis module. It is used in order to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment