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 --- hiredis.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'hiredis.h') diff --git a/hiredis.h b/hiredis.h index 20e9bfa..fe2dae4 100644 --- a/hiredis.h +++ b/hiredis.h @@ -176,8 +176,10 @@ typedef struct { int type; /* bit field of REDIS_OPT_xxx */ int options; - /* timeout value. if NULL, no timeout is used */ - const struct timeval *timeout; + /* timeout value for connect operation. if NULL, no timeout is used */ + const struct timeval *connect_timeout; + /* timeout value for commands. if NULL, no timeout is used. (can be set later on with redisSetTimeout/redisAsyncSetTimeout) */ + const struct timeval *command_timeout; union { /** use this field for tcp/ip connections */ struct { @@ -230,7 +232,8 @@ typedef struct redisContext { redisReader *reader; /* Protocol reader */ enum redisConnectionType connection_type; - struct timeval *timeout; + struct timeval *connect_timeout; + struct timeval *command_timeout; struct { char *host; -- cgit v1.2.3