summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-10-23 10:52:25 +0200
committerantirez <antirez@gmail.com>2019-10-23 18:39:53 +0200
commit8cccc6b468f4b134964d4500c44486db681311cb (patch)
treea9ae8d9a48dcc3aad466c337dd74f99fccdef0b6 /src
parent83de18805cbee7df18aa788d153bf5a974cf5f34 (diff)
downloadredis-8cccc6b468f4b134964d4500c44486db681311cb.tar.gz
Modules hooks: don't call the hook for fake clients.
Diffstat (limited to 'src')
-rw-r--r--src/networking.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/networking.c b/src/networking.c
index dec49642f..e7cc561fa 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -1043,9 +1043,13 @@ void freeClient(client *c) {
freeClientAsync(c);
return;
}
- moduleFireServerEvent(REDISMODULE_EVENT_CLIENT_CHANGE,
- REDISMODULE_SUBEVENT_CLIENT_CHANGE_DISCONNECTED,
- c);
+
+ /* For connected clients, call the disconnection event of modules hooks. */
+ if (c->conn) {
+ moduleFireServerEvent(REDISMODULE_EVENT_CLIENT_CHANGE,
+ REDISMODULE_SUBEVENT_CLIENT_CHANGE_DISCONNECTED,
+ c);
+ }
/* If it is our master that's beging disconnected we should make sure
* to cache the state to try a partial resynchronization later.