summaryrefslogtreecommitdiff
path: root/src/debug.c
diff options
context:
space:
mode:
authorBinbin <binloveplay1314@qq.com>2023-03-12 23:50:44 +0800
committerGitHub <noreply@github.com>2023-03-12 17:50:44 +0200
commit416842e6c004dbd951e398a8651df6c56a030a23 (patch)
tree47ef38bcf6e592441d6e50b4cd1e44271c923511 /src/debug.c
parent4e7eb16ae70d2664d169e412b965f6e9143de7a0 (diff)
downloadredis-416842e6c004dbd951e398a8651df6c56a030a23.tar.gz
Fix the bug that CLIENT REPLY OFF|SKIP cannot receive push notifications (#11875)
This bug seems to be there forever, CLIENT REPLY OFF|SKIP will mark the client with CLIENT_REPLY_OFF or CLIENT_REPLY_SKIP flags. With these flags, prepareClientToWrite called by addReply* will return C_ERR directly. So the client can't receive the Pub/Sub messages and any other push notifications, e.g client side tracking. In this PR, we adding a CLIENT_PUSHING flag, disables the reply silencing flags. When adding push replies, set the flag, after the reply, clear the flag. Then add the flag check in prepareClientToWrite. Fixes #11874 Note, the SUBSCRIBE command response is a bit awkward, see https://github.com/redis/redis-doc/pull/2327 Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/debug.c b/src/debug.c
index 7a02c332b..41722a901 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -807,9 +807,12 @@ NULL
addReplyError(c,"RESP2 is not supported by this command");
return;
}
+ uint64_t old_flags = c->flags;
+ c->flags |= CLIENT_PUSHING;
addReplyPushLen(c,2);
addReplyBulkCString(c,"server-cpu-usage");
addReplyLongLong(c,42);
+ if (!(old_flags & CLIENT_PUSHING)) c->flags &= ~CLIENT_PUSHING;
/* Push replies are not synchronous replies, so we emit also a
* normal reply in order for blocking clients just discarding the
* push reply, to actually consume the reply and continue. */