summaryrefslogtreecommitdiff
path: root/async.h
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2020-07-19 18:54:42 -0700
committerGitHub <noreply@github.com>2020-07-19 18:54:42 -0700
commit2e7d7cbabd32912342218078282fce92f6cc0ab6 (patch)
treeba60c50c28b433aef6e128a67522085751acb6cb /async.h
parent1864e76ea7323fd8789d9c8b5b3c8ca27d4840a6 (diff)
Resp3 oob push support (#841)
Proper support for RESP3 PUSH messages. By default, PUSH messages are now intercepted and the reply memory freed. This means existing code should work unchanged when connecting to Redis >= 6.0.0 even if `CLIENT TRACKING` were then enabled. Additionally, we define two callbacks users can configure if they wish to handle these messages in a custom way: void redisPushFn(void *privdata, void *reply); void redisAsyncPushFn(redisAsyncContext *ac, void *reply); See #825
Diffstat (limited to 'async.h')
-rw-r--r--async.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/async.h b/async.h
index ba301da..b1d2cb2 100644
--- a/async.h
+++ b/async.h
@@ -106,6 +106,9 @@ typedef struct redisAsyncContext {
struct dict *channels;
struct dict *patterns;
} sub;
+
+ /* Any configured RESP3 PUSH handler */
+ redisAsyncPushFn *push_cb;
} redisAsyncContext;
/* Functions that proxy to hiredis */
@@ -118,6 +121,7 @@ redisAsyncContext *redisAsyncConnectUnix(const char *path);
int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn);
int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn);
+redisAsyncPushFn *redisAsyncSetPushCallback(redisAsyncContext *ac, redisAsyncPushFn *fn);
int redisAsyncSetTimeout(redisAsyncContext *ac, struct timeval tv);
void redisAsyncDisconnect(redisAsyncContext *ac);
void redisAsyncFree(redisAsyncContext *ac);