summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-12-28 17:59:26 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-12-28 17:59:26 +0100
commit3d76f3fe02c8fa4eac1bb2fb266897f69f159ee8 (patch)
tree6559a1f97bda5589281ba44723ed67dfc2da6c97
parent2c17d2e22163437a6d4ee1ab41f401115468bbad (diff)
Add write event after setting connect callback
-rw-r--r--async.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/async.c b/async.c
index 5c11243..6cece18 100644
--- a/async.c
+++ b/async.c
@@ -96,6 +96,11 @@ int redisAsyncSetReplyObjectFunctions(redisAsyncContext *ac, redisReplyObjectFun
int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn) {
if (ac->onConnect == NULL) {
ac->onConnect = fn;
+
+ /* The common way to detect an established connection is to wait for
+ * the first write event to be fired. This assumes the related event
+ * library functions are already set. */
+ if (ac->evAddWrite) ac->evAddWrite(ac->_adapter_data);
return REDIS_OK;
}
return REDIS_ERR;