diff options
Diffstat (limited to 'contrib/hiredis/async.c')
-rw-r--r-- | contrib/hiredis/async.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/hiredis/async.c b/contrib/hiredis/async.c index d955203f8..84c43585c 100644 --- a/contrib/hiredis/async.c +++ b/contrib/hiredis/async.c @@ -129,6 +129,7 @@ static redisAsyncContext *redisAsyncInitialize(redisContext *c) { ac->onConnect = NULL; ac->onDisconnect = NULL; + ac->disconnectCbdata = NULL; ac->replies.head = NULL; ac->replies.tail = NULL; @@ -215,9 +216,10 @@ int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn return REDIS_ERR; } -int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn) { +int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn, void *cbdata) { if (ac->onDisconnect == NULL) { ac->onDisconnect = fn; + ac->disconnectCbdata = cbdata; return REDIS_OK; } return REDIS_ERR; @@ -306,9 +308,9 @@ static void __redisAsyncFree(redisAsyncContext *ac) { * this context, the status will always be REDIS_OK. */ if (ac->onDisconnect && (c->flags & REDIS_CONNECTED)) { if (c->flags & REDIS_FREEING) { - ac->onDisconnect(ac,REDIS_OK); + ac->onDisconnect(ac,REDIS_OK,ac->disconnectCbdata); } else { - ac->onDisconnect(ac,(ac->err == 0) ? REDIS_OK : REDIS_ERR); + ac->onDisconnect(ac,(ac->err == 0) ? REDIS_OK : REDIS_ERR,ac->disconnectCbdata); } } |