Add write event after setting connect callback
This commit is contained in:
parent
2c17d2e221
commit
3d76f3fe02
5
async.c
5
async.c
@ -96,6 +96,11 @@ int redisAsyncSetReplyObjectFunctions(redisAsyncContext *ac, redisReplyObjectFun
|
|||||||
int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn) {
|
int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn) {
|
||||||
if (ac->onConnect == NULL) {
|
if (ac->onConnect == NULL) {
|
||||||
ac->onConnect = fn;
|
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_OK;
|
||||||
}
|
}
|
||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
|
Loading…
Reference in New Issue
Block a user