diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-04-24 15:08:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-24 15:08:40 +0100 |
commit | 4e269dc2f8c58fe923b42717b7ea5bcc55bde25d (patch) | |
tree | ee2e86a2d475dc470b87fc184bd6ec2afe514e4c /contrib | |
parent | 5088000ff5670eec3ef588061a0c03f272f1d88c (diff) | |
parent | 544cea204e2f085625b024ea5ad6ff7d0437e1eb (diff) | |
download | rspamd-4e269dc2f8c58fe923b42717b7ea5bcc55bde25d.tar.gz rspamd-4e269dc2f8c58fe923b42717b7ea5bcc55bde25d.zip |
Merge pull request #3313 from arkamar/hiredis
Revert "[Fix] Fix hiredis stupidity" and use the hiredis api as intended
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/hiredis/async.c | 8 | ||||
-rw-r--r-- | contrib/hiredis/async.h | 6 |
2 files changed, 5 insertions, 9 deletions
diff --git a/contrib/hiredis/async.c b/contrib/hiredis/async.c index 851676263..4a2cadf8b 100644 --- a/contrib/hiredis/async.c +++ b/contrib/hiredis/async.c @@ -129,7 +129,6 @@ static redisAsyncContext *redisAsyncInitialize(redisContext *c) { ac->onConnect = NULL; ac->onDisconnect = NULL; - ac->disconnectCbdata = NULL; ac->replies.head = NULL; ac->replies.tail = NULL; @@ -216,10 +215,9 @@ int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn return REDIS_ERR; } -int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn, void *cbdata) { +int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn) { if (ac->onDisconnect == NULL) { ac->onDisconnect = fn; - ac->disconnectCbdata = cbdata; return REDIS_OK; } return REDIS_ERR; @@ -308,10 +306,10 @@ 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->disconnectCbdata); + ac->onDisconnect(ac,REDIS_OK); } else { c->flags |= REDIS_FREEING; - ac->onDisconnect(ac,(ac->err == 0) ? REDIS_OK : REDIS_ERR,ac->disconnectCbdata); + ac->onDisconnect(ac,(ac->err == 0) ? REDIS_OK : REDIS_ERR); } } diff --git a/contrib/hiredis/async.h b/contrib/hiredis/async.h index 40a5a49c8..f19139c6f 100644 --- a/contrib/hiredis/async.h +++ b/contrib/hiredis/async.h @@ -54,7 +54,7 @@ typedef struct redisCallbackList { } redisCallbackList; /* Connection callback prototypes */ -typedef void (redisDisconnectCallback)(const struct redisAsyncContext*, int status, void *cbdata); +typedef void (redisDisconnectCallback)(const struct redisAsyncContext*, int status); typedef void (redisConnectCallback)(const struct redisAsyncContext*, int status); /* Context for an async connection to Redis */ @@ -85,8 +85,6 @@ typedef struct redisAsyncContext { /* Called when either the connection is terminated due to an error or per * user request. The status is set accordingly (REDIS_OK, REDIS_ERR). */ redisDisconnectCallback *onDisconnect; - /* Hiredis is just brain-damaged here, need to fix it */ - void *disconnectCbdata; /* Called when the first write event was received. */ redisConnectCallback *onConnect; @@ -109,7 +107,7 @@ redisAsyncContext *redisAsyncConnectBindWithReuse(const char *ip, int port, const char *source_addr); redisAsyncContext *redisAsyncConnectUnix(const char *path); int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn); -int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn, void *cbdata); +int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn); void redisAsyncDisconnect(redisAsyncContext *ac); void redisAsyncFree(redisAsyncContext *ac); |