summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2022-08-25 12:08:20 -0700
committermichael-grunder <michael.grunder@gmail.com>2022-08-26 10:14:47 -0700
commit6a3e96ad2149584e441b0e8a5827dc6c2624035b (patch)
tree04fd2496251b711109b73046270f1231a61eb662 /README.md
parente7afd998f9ce3e6dfaa5e6534f779cab6a1c5a7b (diff)
Maintain backward compatibiliy withour onConnect callback.
In f69fac7690fb22a7fc19dba61ef70e5f79ccb2e9, our async onConnect callback was improved to take a non-const redisAsyncContext allowing it to be reentrant. Unfortunately, this is a breaking change we can't make until hiredis v2.0.0. This commit creates a separate callback member and corresponding function that allows us to use the new functionality, while maintaining our existing API for legacy code. Fixes #1086
Diffstat (limited to 'README.md')
-rw-r--r--README.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/README.md b/README.md
index b0b2aff..ff50d13 100644
--- a/README.md
+++ b/README.md
@@ -372,6 +372,8 @@ the disconnect callback is a good point to do so.
Setting the connect or disconnect callbacks can only be done once per context. For subsequent calls the
api will return `REDIS_ERR`. The function to set the callbacks have the following prototype:
```c
+/* Alternatively you can use redisAsyncSetConnectCallbackNC which will be passed a non-const
+ redisAsyncContext* on invocation (e.g. allowing writes to the privdata member). */
int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn);
int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn);
```