summaryrefslogtreecommitdiff
path: root/src/blocked.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-10-07 11:55:35 +0200
committerantirez <antirez@gmail.com>2016-10-07 11:55:35 +0200
commit8fadfe52a2d1abf3d4d12707004f1209703d446c (patch)
tree3657b6cd3f52b79d9e2cb1ef185c1fb6d23dd15e /src/blocked.c
parenta5998d1fda00862e57671d6986f2d8865ef5fd19 (diff)
downloadredis-8fadfe52a2d1abf3d4d12707004f1209703d446c.tar.gz
Module: API to block clients with threading support.
Just a draft to align the main ideas, never executed code. Compiles.
Diffstat (limited to 'src/blocked.c')
-rw-r--r--src/blocked.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/blocked.c b/src/blocked.c
index d22872548..54b26b713 100644
--- a/src/blocked.c
+++ b/src/blocked.c
@@ -136,6 +136,8 @@ void unblockClient(client *c) {
unblockClientWaitingData(c);
} else if (c->btype == BLOCKED_WAIT) {
unblockClientWaitingReplicas(c);
+ } else if (c->btype == BLOCKED_MODULE) {
+ unblockClientFromModule(c);
} else {
serverPanic("Unknown btype in unblockClient().");
}
@@ -153,12 +155,15 @@ void unblockClient(client *c) {
}
/* This function gets called when a blocked client timed out in order to
- * send it a reply of some kind. */
+ * send it a reply of some kind. After this function is called,
+ * unblockClient() will be called with the same client as argument. */
void replyToBlockedClientTimedOut(client *c) {
if (c->btype == BLOCKED_LIST) {
addReply(c,shared.nullmultibulk);
} else if (c->btype == BLOCKED_WAIT) {
addReplyLongLong(c,replicationCountAcksByOffset(c->bpop.reploffset));
+ } else if (c->btype == BLOCKED_MODULE) {
+ moduleBlockedClientTimedOut(c);
} else {
serverPanic("Unknown btype in replyToBlockedClientTimedOut().");
}