summaryrefslogtreecommitdiff
path: root/async.h
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-12-07 10:22:30 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-12-07 10:22:30 +0100
commit12725f88ed2f77ee7a003458906c34dc20511e0e (patch)
tree8217f41642a5aeea148846a534328d409725cc60 /async.h
parent822efe2ac3174685ec26d3e01e223fe25ed77aa2 (diff)
Fire onConnect callback on the first write event
Diffstat (limited to 'async.h')
-rw-r--r--async.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/async.h b/async.h
index 19c522b..2ef0e21 100644
--- a/async.h
+++ b/async.h
@@ -50,8 +50,9 @@ typedef struct redisCallbackList {
redisCallback *head, *tail;
} redisCallbackList;
-/* Disconnect callback prototype */
+/* Connection callback prototypes */
typedef void (redisDisconnectCallback)(const struct redisAsyncContext*, int status);
+typedef void (redisConnectCallback)(const struct redisAsyncContext*);
/* Context for an async connection to Redis */
typedef struct redisAsyncContext {
@@ -80,6 +81,9 @@ typedef struct redisAsyncContext {
* user request. The status is set accordingly (REDIS_OK, REDIS_ERR). */
redisDisconnectCallback *onDisconnect;
+ /* Called when the first write event was received. */
+ redisConnectCallback *onConnect;
+
/* Reply callbacks */
redisCallbackList replies;
} redisAsyncContext;
@@ -87,6 +91,7 @@ typedef struct redisAsyncContext {
/* Functions that proxy to hiredis */
redisAsyncContext *redisAsyncConnect(const char *ip, int port);
int redisAsyncSetReplyObjectFunctions(redisAsyncContext *ac, redisReplyObjectFunctions *fn);
+int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn);
int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn);
void redisAsyncDisconnect(redisAsyncContext *ac);