From 38b5ae543f5c99eb4ccabbe277770fc6bc81226f Mon Sep 17 00:00:00 2001 From: valentinogeron Date: Sun, 26 Jul 2020 22:32:27 +0300 Subject: add a command_timeout to redisContextOptions (#839) Add an additional timeout so the user has a convenient way of controlling distinct connect and command timeouts --- async.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'async.c') diff --git a/async.c b/async.c index 1073d8d..020cb09 100644 --- a/async.c +++ b/async.c @@ -868,19 +868,19 @@ redisAsyncPushFn *redisAsyncSetPushCallback(redisAsyncContext *ac, redisAsyncPus } int redisAsyncSetTimeout(redisAsyncContext *ac, struct timeval tv) { - if (!ac->c.timeout) { - ac->c.timeout = hi_calloc(1, sizeof(tv)); - if (ac->c.timeout == NULL) { + if (!ac->c.command_timeout) { + ac->c.command_timeout = hi_calloc(1, sizeof(tv)); + if (ac->c.command_timeout == NULL) { __redisSetError(&ac->c, REDIS_ERR_OOM, "Out of memory"); __redisAsyncCopyError(ac); return REDIS_ERR; } } - if (tv.tv_sec != ac->c.timeout->tv_sec || - tv.tv_usec != ac->c.timeout->tv_usec) + if (tv.tv_sec != ac->c.command_timeout->tv_sec || + tv.tv_usec != ac->c.command_timeout->tv_usec) { - *ac->c.timeout = tv; + *ac->c.command_timeout = tv; } return REDIS_OK; -- cgit v1.2.3 From 5003906d633dd4b96a3a60d1f63188ffaca3140e Mon Sep 17 00:00:00 2001 From: Michael Grunder Date: Fri, 31 Jul 2020 13:23:28 -0700 Subject: Define a no op assert if we detect NDEBUG (#861) Addresses #642 --- async.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'async.c') diff --git a/async.c b/async.c index 020cb09..18a4a09 100644 --- a/async.c +++ b/async.c @@ -47,6 +47,11 @@ #include "async_private.h" +#ifdef NDEBUG +#undef assert +#define assert(e) (void)(e) +#endif + /* Forward declarations of hiredis.c functions */ int __redisAppendCommand(redisContext *c, const char *cmd, size_t len); void __redisSetError(redisContext *c, int type, const char *str); -- cgit v1.2.3